CCyberwiki

Slopsquatting

Slopsquatting
ClassSoftware supply chain
Related toTyposquatting, Dependency confusion and typosquatting
OWASP Top 10A03:2025 Software Supply Chain Failures
OWASP Top 10 for LLM ApplicationsLLM09:2025 Misinformation
MITRE ATT&CKT1195.001 Compromise Software Dependencies and Development Tools
Typical severityCritical once installed
AffectsProjects whose code or install commands come from AI coding assistants and agents, mainly in the npm and PyPI ecosystems

A coding assistant that writes a program (see Security of AI-generated code) also writes the names of the packages the program needs, in import lines and install commands, and some of those names belong to no package at all. Slopsquatting is the registration of such an invented name on a public package registry, so that the next developer or AI agent given the same suggestion installs the attacker's package.1 The word was coined by Seth Larson, Developer-in-Residence at the Python Software Foundation.1 In typosquatting the attacker registers a misspelling of a real name and counts on people mistyping it; here the misleading name comes from a language model, which produces a plausible name that was never published.2

Package hallucination

Researchers call a model's reference to a package that does not exist a package hallucination.3 In a study presented at USENIX Security 2025, 16 code-generating models wrote 576,000 Python and JavaScript samples, and about one package name in five that they used was missing from PyPI and npm (Table 1).3

Table 1. Main figures of the 2025 package hallucination study
MeasureResult
Package names in all samples that did not exist440,445 of 2.23 million (19.7%)
Distinct invented names205,474
Invented share, commercial GPT models and open-source models5.2% and 21.7%
Lowest rate (GPT-4 Turbo)3.59%
Invented share in Python and in JavaScript samples15.8% and 21.3%
Invented names returned in all 10 reruns of the same prompt43%
Invented names that never came back in 10 reruns39%
Invented names produced by only one model81%
Invented Python names within one or two characters of a real package13.4% (10,263 of 76,489)

The rate rose with the model's temperature in every model tested, and at the highest settings the open-source models named more invented packages than real ones. In the Python tests, questions about packages that had become popular within the past year produced more invented names than older topics, partly because a model knows nothing released after its training data was collected. Limiting the model to its more probable words (the top-p, top-k and min-p settings) did not lower the rate; it rose by 1.16% on average. The authors conclude that an invented package name is often among the model's most probable answers, so always picking the most likely word would still produce it.3

Most invented names are not near-misses of real ones, so an attacker cannot derive most of them from misspellings of popular packages and has to collect them from model output. Packages deleted from PyPI were a negligible source: of 12,871 packages that were on PyPI between 2020 and 2022 and were later removed, the models named 133.3

How the attack works

An invented name is worth registering only if models keep producing it, and Table 1 shows that many do. The attacker in the study's threat model uses the same models as the victims, finds the names they invent by checking their output against the registry, and publishes packages under those names.3 Installing a Python or JavaScript package can run its publisher's code on the machine,3 so the package does harm before any line of the project calls it; see Package install scripts.

Agents shorten the path further. When npx is asked to run a package that is not in the project, it downloads the package into the npm cache after printing a confirmation prompt, which the --yes flag suppresses.4 In the react-codeshift case below, an agent following written instructions answered the prompt with yes itself.5 The instructions often come from agent skill files (SKILL.md), which an agent loads when needed and carries out with the permissions of its own process.6

Recorded cases

In a report published in March 2024, Bar Lanyado of Lasso Security described huggingface-cli, a Python package name that models invented during his tests. He uploaded an empty package under that name, plus a dummy package with a random name to estimate how many downloads came from automated scanners. Within three months the empty package had more than 30,000 downloads he counted as genuine, and the README of an Alibaba research repository told its readers to install it.7

On 14 January 2026 Charlie Eriksen of Aikido published an empty react-codeshift on npm. By then 237 GitHub repositories told AI agents to run it with npx. He traced the name to a single commit of 17 October 2025 that added 47 machine-written agent skills to a public repository, at least two of which called the command. The name merges two real tools, jscodeshift and react-codemod, and the skill files spread mostly through forks, about 100 of which kept the original path. An unused new package gets 60 to 100 downloads on its first day from mirrors and scanners and none after; this one kept receiving one to four a day, which Eriksen attributes to agents following the skills.5 As with huggingface-cli, a researcher registered the name before an attacker did.

Checking a suggested package

A suggested name can be looked up before it is installed. npm view prints the registry's record for a package, and its time field lists when each version was published:8

npm view react-codeshift
npm view react-codeshift time

A package that is missing, that first appeared days ago, that has few downloads, or whose source repository has no real history of commits and contributors calls for a closer look before it goes into the project. The same lookup can run in CI on every dependency a pull request adds.2 The npx prompt only protects a project when someone reads it, so scripts and agent instructions that pass --yes remove that step.4 Agent skill files that contain install commands deserve the same review as source code.5

On the model side, the study combined three methods: adding real package data to the prompt, a self-check in which the model reviews its own package list, and further training on labelled examples (fine-tuning). Together they cut the rate by 85% for DeepSeek and 64% for CodeLlama, and three of the four models tested recognised their own invented names with accuracy above 75%.3

Prompt for a coding agent

List every package this project installs or tells someone to run: dependencies in package.json and requirements files, and every npm install, npx, bunx, pnpm dlx, yarn dlx, pip install and uvx command in scripts, READMEs, CI workflows and agent skill or instruction files. For each npm package, run npm view <name> and npm view <name> time, and report whether it exists, when its first version was published and which repository it links to. For PyPI packages, report the same from the PyPI page. Do not install or run anything. Flag every name that does not exist, was first published recently with little release history, or has no linked repository, and suggest the established package the code most likely meant.

In SecFlash

When a package registered under an invented name is published as malware, SecFlash reports it in the project's dependencies as SF-SEC-713 on the Security page and as SF-THR-201 on the Threats page.

See also

References

  1. a b Socket (8 April 2025). "The Rise of Slopsquatting: How AI Hallucinations Are Fueling a New Class of Supply Chain Attacks". Socket blog.
  2. a b "NPM Security Cheat Sheet". OWASP Cheat Sheet Series.
  3. a b c d e f g Spracklen, J., Wijewickrama, R., Sakib, A. H. M. N., Maiti, A., Viswanath, B., Jadliwala, M. (2025). "We Have a Package for You", an analysis of package hallucinations by code-generating LLMs. 34th USENIX Security Symposium.
  4. a b npm. "npx". npm Docs, CLI v11.
  5. a b c Eriksen, C. (21 January 2026). "Agent Skills Are Spreading Hallucinated npx Commands". Aikido blog.
  6. back MITRE. "Supply Chain Compromise: Compromise Software Dependencies and Development Tools". MITRE ATT&CK, T1195.001.
  7. back Lanyado, B. (28 March 2024). "Diving into AI Package Hallucinations". Lasso Security blog.
  8. back npm. "npm-view". npm Docs, CLI v11.