What is slopsquatting? When a model invents a package

By

Slopsquatting is registering a package name a language model invented, so a later install of that name runs someone else's code. What a 2025 study measured.

Slopsquatting is registering a package name that a language model made up. The name was not on npm or PyPI when the model wrote it. Someone publishes that exact name. The next install of the model’s suggestion downloads their package.

Seth Michael Larson, security developer-in-residence at the Python Software Foundation, gave it that name. The Register reported it on April 12, 2025. “Slop” is the usual jab at model output. The attack sits next to typosquatting, which copies a real name with a small misspelling. Slopsquatting does not need the real name. It needs the model to repeat a name that was never real.

A hallucination is the model being wrong. Slopsquatting is what a person does with that wrong name.

How slopsquatting works

The model writes an import or install command for a package that doesn’t exist in the registry, so installing it fails at first because nobody owns the name.

An attacker turns that into an attack by prompting models with the same questions, collecting frequently hallucinated names, and publishing malicious packages under those names so your agent’s next npm install or pip install silently succeeds.

A 2025 paper (which preceded the term “slopsquatting”) measured how often code models from the January 20, 2024 EvalPlus leaderboard plus GPT-3.5, GPT-4, and GPT-4 Turbo invent package names, though those numbers reflect those models rather than current Claude Code or Codex models.

Spracklen, Wijewickrama, Sakib, Maiti, Viswanath, and Jadliwala ran 30 tests across 16 Python and 14 JavaScript models, generating 576,000 code samples and 2.23 million package recommendations. Of those, 440,445 (19.7%, with 205,474 unique names) weren’t in PyPI or npm: 5.2% on GPT-series models (3.59% on GPT-4 Turbo) and 21.7% on open-source models, averaging 15.8% in Python and 21.3% in JavaScript.

When they re-ran 500 hallucinating prompts 10 times each, 43% of the invented names returned on all 10 tries, 58% returned more than once, and 39% never returned. That predictability makes popular hallucinations profitable targets to register.

Most of those names are not one-character typos. Of 76,489 names they compared with a real package, 13.4% were one or two edits away. 48.6% were six edits or more.

Their threat model assumes a user who installs model-suggested packages without checking, and an attacker who can query the same models and publish missing names without touching model weights (the authors withheld the list of invented names).

How an invented package name becomes an installA model writes a package name that is not in the registry. Someone registers that name. A later install downloads their package.Model writes apackage nameName missing fromthe registrySomeone registersthat nameA later installdownloads their code

Slopsquatting in each tool

None of the four coding-agent docs describe a scanner that blocks invented package names. An install is a shell command. It goes through the permission mode you already set, and through the sandbox if the tool has one. Those pages do not mention package names.

Claude CodeCodexCursorGrok Build
A documented check for invented package namesNot documentedNot documentedNot documentedNot documented
What still appliesInstalls are shell commands, so your permission mode appliesSameSameSame

Claude Code

The Claude Code docs do not describe slopsquatting, a package allowlist, or a registry lookup before install.

See the Claude Code docs index.

OpenAI Codex

The Codex docs do not describe a package-name check. An install is still a shell command, so your permission rules for shell commands still apply.

See the Codex docs index.

Cursor

The Cursor docs do not describe a package-name check.

See the Cursor docs index.

Grok Build

The Grok docs do not describe a package-name check.

See the xAI docs index.

Details checked against each vendor’s documentation in November 2026. The rates above are from the March 2, 2025 revision of the package-hallucination paper, and the name is from The Register, April 12, 2025.

A real example

Before you install a name the model wrote, ask the registry who already owns it. This is express, which has been on npm since 2010:

npm view express name version time.created --json

On November 4, 2026 the registry answered:

{
  "name": "express",
  "version": "5.3.0",
  "time.created": "2010-12-29T19:38:25.450Z"
}

The version moves. The created time is the check. A name that has existed since 2010 is not something a model invented this morning. If npm view errors because the name is missing, stop. Do not install it to “see what happens.” This page does not print an invented name. The paper withheld that list so people would not register it.

For Python, open the project page on pypi.org. A page that exists only tells you the name is taken. It does not tell you the model meant this package.

When to use the check

Check whenever an agent adds a dependency you don’t already use (a new import, package.json entry, or requirements.txt line), inspecting the package name, publish date, and project reputation.

You can skip this check when bumping an already-pinned dependency, which has a different failure mode covered in Securing your projects with AI (compromised real releases vs invented names).

Larson’s practical checklist in that Register piece is simple: verify the package is known, check for typos, look inside it, and mirror an approved subset of PyPI if you’re running an organization.

Pitfalls

A successful install only proves the name exists now, not that the model was right. Once an attacker registers the name, an existence check against npm or PyPI passes with HTTP 200.

Don’t quote 19.7% as a current product metric: that figure came from 576,000 samples in a 2024-era study where GPT-series models hit 5.2% and open-source models hit 21.7%.

Re-running the same prompt won’t save you either, because 43% of retested hallucinations returned on every single try.

Typosquatting (a one-character misspelling of a popular package) and compromised releases of real packages (like LiteLLM’s October 2026 release in the security post) sit right next to slopsquatting. Never let an agent install a new dependency unreviewed, and use permission modes to pause installs for approval.

  • Permission modes: Permission modes decide what a coding agent can do without asking. The modes in Claude Code, Codex, Cursor and Grok Build, and what YOLO mode really skips.
  • Sandbox: An agent sandbox limits which files and hosts a coding agent's commands can reach. How the boundary works in Claude Code, Codex, Cursor and Grok Build.

All AI glossary entries → · AI for coding hub →

Want me to talk about your product? You can sponsor this site.