Skip to the content
AI and Cybersecurity Learning and Practice Center Test automation Open the Learning Center

IncidentSupply chain

Slopsquatting: attackers can register the packages AI makes up

MediumAI coding assistants

AI coding assistants sometimes suggest installing packages that do not exist. The same made-up names come up again and again, so an attacker can register them with malicious code and wait for people, or agents, to install them.

Replay the attack step by step in the Learning Center

How it happened

  1. A developer asks an AI model for code, and it imports a package that does not exist.
  2. Across 576,000 code samples from 16 models, researchers found hundreds of thousands of unique hallucinated names.
  3. Many names repeat reliably across runs, so they are predictable.
  4. An attacker registers them on the public registry, and anyone who installs the suggestion runs the code.

Impact

Code running on developer machines and build systems that install the suggested package.

The fix

No single patch; allowlists, internal mirrors and dependency scanning block unknown packages.

Lessons

  • Check that every AI-suggested dependency exists, is the intended project and has a real history.
  • Give coding agents an allowlist or an internal registry mirror.
  • Use lockfiles and dependency scanning in CI.

Sources