Slopsquatting: How to Stop Your AI Installing Fake Packages
In one study, nearly 1 in 5 packages suggested by AI did not exist, and attackers register those names. How to check, gate and lock your installs.
Search for a command to run...
In one study, nearly 1 in 5 packages suggested by AI did not exist, and attackers register those names. How to check, gate and lock your installs.

Ask an AI coding tool for help and it will often suggest a package to install. Most of the time the package is real. Sometimes it is not, and the invented name sounds so plausible that an attacker has already registered it, with malware inside. The attack has a name, slopsquatting, and coding agents make it easier to fall for, because the agent is often the one typing the install command.
Below: what slopsquatting is, the numbers behind the "one in five" headline, why agents raise the stakes, and the checks, gates and lockfile habits that close the hole.
Typosquatting waits for a human to mistype a real package name, such as reqeusts instead of requests. Slopsquatting does not wait for a mistake; it predicts one. The attacker collects package names that AI models invent, registers the ones that keep coming back, and waits for someone to paste the model’s suggestion into a terminal.
The term was coined in 2025 by Seth Larson of the Python Software Foundation, according to this write-up on dev.to, which is a good overview of both the attack and the defences.
What makes it work is predictability. If models invented a different fake name every time, there would be nothing worth registering. They do not.
The figure comes from a study presented at USENIX Security 2025, We Have a Package for You!, which analysed package hallucinations by code-generating models. As summarised in the dev.to article:
The 43% repeat rate is the number to remember. An attacker does not need to guess. They can run popular prompts, collect the names that keep appearing, and register them before anyone else does.
The same article reports a 2026 re-evaluation of frontier models with lower rates, between 4.6% and 6.1%, and 127 package names that five different frontier models hallucinated identically. Lower is better, but it is not zero, and identical hallucinations across vendors are exactly what an attacker hopes for.
Hallucinated package names are not random strings. Models learn the naming habits of each ecosystem, the -sdk and -utils suffixes, the framework prefixes, the way helpers are named after the library they extend, and they generate new names that fit those habits perfectly. The dev.to article gives aws-helper-sdk and fastapi-middleware as examples of the kind of names models produce: each one sounds like something that should exist.
According to the same write-up, about 38% of hallucinated names were conflations of two real packages and about 13% were simple typos of real ones. The rest were plausible inventions. That mix is why a quick glance does not protect you: a conflated name looks familiar precisely because both halves are real.
A person copying a suggestion has a moment of friction: they read the name, perhaps search for it, then paste. An agent with shell access has no such moment. It decides a dependency is needed, runs the install, and moves on, often in the middle of a long task you are not watching line by line.
Volume matters too. Even at a 5% rate, an agent that proposes 40 packages across a project is likely to propose at least one that does not exist: if each suggestion were independent, the odds would be about 87%. Most of those will simply fail to install. The danger is the one that installs fine because someone registered it first.
Agents also write documentation. A hallucinated package that lands in a README or a setup guide gets copied by the next person and read by the next model, which is how one invented name spreads.
These checks take seconds once they are a habit, and they are exactly what you should ask your agent to do before any install.
The dev.to article also recommends age-gating: rejecting any package first published within about 90 days unless a human approves it. Almost every dependency you genuinely need is older than that.
The strongest fix is to make dependency changes a decision the agent has to ask for. In Claude Code, permission rules in settings.json can require your approval for specific commands. Rules use the same wildcard form as the documented example Bash(npm run test *), so an ask list such as Bash(npm install *), Bash(pnpm add *) and Bash(pip install *) makes every install pause until you approve it.
Pair it with one rule in your AGENTS.md or CLAUDE.md:
"Never add a dependency without first confirming it exists on the registry and telling me its first publish date, weekly downloads and repository."
The permission makes the pause mandatory. The rule makes sure the agent arrives at the pause carrying the evidence. Other coding agents have equivalent approval settings, and the principle is the same whatever you use: an agent can suggest a dependency, but a human adds it.
Most of the list above assumes a team with CI and code review. If it is just you and an agent, this is the short version, and it takes about five minutes:
Treat it like any other compromise, quickly and in order:
Slopsquatting is a new name for an old lesson: never run code you have not checked, even when a confident assistant tells you to. What changed is the volume and the speed. Your agent can add a dependency faster than you can read its name, so the checks have to live in your settings and your CI, not in your attention.
For more practical notes like this, get the HelloBuilder newsletter. It lands every Monday.
Get the weekly digest for AI builders & vibe coders. Curated tools, resources, and stories. Skip the scroll.