Dev.to Security πŸ” Cybersecurity πŸ‘ 2 πŸ“– 8 min read

Five AI Models Invented the Same 104 Packages. None of Them Exist.

AI models invent fewer package names than they did in 2024, but they still do it, and coding agents now install what they suggest. Here is what the newest research found, and five checks that close the gap. Ask an AI mo

AI models invent fewer package names than they did in 2024, but they still do it, and coding agents now install what they suggest. Here is what the newest research found, and five checks that close the gap.

Ask an AI model for code and, every so often, it will tell you to install a package that has never existed. The name sounds right. It follows the naming style of the ecosystem. It would make sense if it existed. Then pip install fails, you shrug, and you move on.

This story was written with the assistance of an AI writing program. The figures come from the papers and write-ups named in the text.

The failed install is the good outcome. The bad one is when somebody has already registered that made-up name, and the install works. This attack has a name, slopsquatting, and in 2026 it changed in an important way: the thing typing npm install is often no longer a person.

What slopsquatting is

The term comes from Seth Larson, the Python Software Foundation's security developer-in-residence. The idea builds on typosquatting. A typosquatter registers reqeusts and waits for someone to make a typo. A slopsquatter registers a name that AI models invent on their own, and waits for a model to recommend it.

Registering a package on PyPI or npm costs nothing and needs only an email address. So the only question that matters is how often models invent names, and whether they keep inventing the same ones.

The 2024 baseline: one in five

The study everyone cites is by Joseph Spracklen and colleagues at the University of Texas at San Antonio, presented at USENIX Security 2025. They ran 16 code models on two sets of prompts and generated 576,000 code samples in Python and JavaScript.

Those samples referenced 2.23 million packages. 440,445 of them, 19.7%, did not exist. That added up to 205,474 unique made-up names.

The split between kinds of model was large. Commercial models invented names in about 5.2% of package references on average. Open-source models did so in 21.7%. The best model, GPT-4 Turbo, came in at 3.59%.

The finding that made this a security problem was repeatability. When the team ran the same prompt ten times, 43% of the invented names came back in all ten runs. A name that shows up once is noise. A name that shows up every time is a target you can plan around.

The 2026 re-run: better, but not fixed

This year, independent researcher Aleksandr Churilov repeated the study on five newer models: Claude Sonnet 4.6, Claude Haiku 4.5, GPT-5.4-mini, Gemini 2.5 Pro and DeepSeek V3.2. The run covered 199,840 generations using the Spracklen prompts. The fourth version of the paper, from November, checks every name against the live PyPI and npm registries instead of older package lists.

Here is the good news. Every model now sits where 2024's best commercial models sat:

  • Claude Haiku 4.5: 3.63% of package mentions
  • Claude Sonnet 4.6: 4.09%
  • Gemini 2.5 Pro: 4.77%
  • DeepSeek V3.2: 4.80%
  • GPT-5.4-mini: 5.02%

The open-weight model is no longer an outlier. DeepSeek sits inside the commercial cluster, so the 21.7% era looks to be over at the frontier. (The paper only tested frontier models. Smaller local models may still behave like 2024.)

Two smaller findings stood out. Python was worse than JavaScript for every model, which reverses the 2024 pattern. And Claude Haiku made up fewer names than the larger Claude Sonnet, which the author says he can't explain.

Here is the bad news, in the paper's own framing: the range shrinks, but the threat remains. Even the best model produced 1,098 invented package mentions across about 40,000 prompts, covering 605 unique names. A rate of 3.6% sounds small until you multiply it by the number of developers and agents asking these models for code every day.

The 104 names all five models agree on

The most useful number in the new paper is 104. That's how many made-up package names all five models produced: 88 for PyPI and 16 for npm.

That matters because it removes the attacker's need to pick a model. A name that only one model invents only reaches that model's users. A name that all five invent reaches everyone, whichever assistant they use. One registration covers the whole market.

More than half of those names, 54 of the 104, are one character away from a real package. They are near misses rather than wild guesses, which is exactly why a quick look won't catch them.

The author offers a plausible explanation: tutorials and forum posts often call a package by its import name or a nickname, not its real install name. Every provider trains on roughly the same public web, so they all learn the same wrong name. Fixing it at one company doesn't fix it at the others.

The paper also checked what happened to these names after the study. About 1% of all the invented names were registered by someone within six months. At least one was registered with malware, which npm later removed. And at least 23 names the models still suggest had hosted malware in the past, before the registries took it down. The models still recommend the name, even though the registry already caught the attack once.

The author disclosed the list to PyPI's security team and to Socket before publishing and doesn't print most of the names. That's the right call, and I won't guess at them here either.

When the agent does the installing

All of this used to have a human in the middle. A developer read the suggestion, typed the command, and could notice something odd.

Coding agents remove that person. Claude Code, Cursor, Codex and the rest run shell commands themselves, often several in a row, often in a mode where nobody approves each one. And they don't only read your prompt. They read rule files, skill files and READMEs, any of which can contain an install command.

The clearest real case so far comes from Charlie Eriksen, a malware researcher at Aikido Security. In January he found npx react-codeshift in agent skill files on GitHub. The package didn't exist. It appears to be a model blending two real tools, jscodeshift and react-codemod, into one name that sounds right.

He traced it to a single commit from October 2025 that added 47 AI-generated agent skills to a popular repository, with no sign that anyone reviewed them. Through forks and copies, the command had spread to 237 repositories by the time he looked. He registered the name himself on January 14 as a harmless placeholder, because, as he put it, if he hadn't, an attacker could have.

What happened next is the interesting part. Normal unused package names get a burst of downloads from automated scanners and then nothing. This one kept getting a few downloads a day. Eriksen's reading is that those were agents trying to run the skill.

No one was harmed in that case. But it shows the full chain working: a model invents a name, the name gets written into a file that agents trust, the file gets copied hundreds of times, and agents run it without checking.

A second paper shows the deliberate version. Researchers at Duke University published PackHallu in October. It's a method for writing instructions into rule files like AGENTS.md or .cursorrules that push a coding agent to import a package the attacker controls in place of the real one. They tested eight agent tools, including Claude Code and Cursor, and report high success rates that carried over between tools. They also tested five prompt-injection detectors, and none caught the attack reliably without also flagging too much normal text.

Five checks that close most of the gap

You don't need a new product to deal with this. You need to stop installing names you haven't checked, and to make your agents follow the same rule.

1. Don't let agents install packages without asking. Most agent tools let you require approval for specific commands. Put pip install, npm install, npx, uvx, bunx and pnpm dlx on the ask-first list. In Claude Code, a PreToolUse hook can block these commands or send them to a checker. It's one extra prompt per new dependency, and that's the point.

2. Check a package exists, and check its age. "It installed" doesn't prove anything, because the attack works precisely when the install succeeds. Before adding a new dependency, look at when it was first published, how many versions it has, and who maintains it. A package created last month with one version and no repository link deserves a second look, especially if its name is one letter off from something famous.

3. Commit lockfiles and install from them. npm ci, uv sync --locked and pip install --require-hashes install exactly what was reviewed and nothing new. An agent that adds a dependency then shows up as a diff in the lockfile, where a reviewer can see it.

4. Treat skill and rule files as code. This is Eriksen's main advice, and it applies to AGENTS.md, CLAUDE.md, .cursorrules and every skill folder you copy from GitHub. They contain commands your agent will run. Review them, keep them in version control, and search them now: grep -rE "npx|pip install|uvx" .claude .cursor AGENTS.md takes seconds.

5. Put a gate on the registry. Teams can route installs through an internal mirror or a package firewall that blocks brand-new or flagged packages. It still works when someone, or something, skips the first four.

The short version

AI models invent package names far less often than they did two years ago. Frontier models are now around 4%, down from about 20% across the 2024 field. But the invented names are consistent, many are shared by every major provider tested, and some of them have already hosted malware.

The bigger change isn't the models. It's who runs the install. When a person installs a fake package, it's one machine. When an agent does it from a skill file that has been copied to 200 repositories, it's a supply chain.

So the fix is a habit, not a tool. Check that a package is real before anything installs it, and require the same from every agent that works in your repository.

Originally published on Medium.

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.