Slopsquatting is a software supply chain attack in which someone registers a package name that AI coding tools invent. When a developer or coding agent installs the suggested package, it runs whatever the registrant uploaded. The Python Software Foundation’s Seth Larson gave it the name in 2025. Studies find invented names in roughly 4% to 20% of package references, and many repeat.

What is slopsquatting?

The Register reported Larson’s term on April 12, 2025. “Slop” is a common insult for AI output. The attack itself takes three steps:

  1. A model writes code or an install command that names a package that does not exist on PyPI or npm.
  2. Someone notices that the model keeps suggesting the same name and registers it.
  3. A developer or an agent runs pip install or npx on the suggestion, and the registrant’s code runs on that machine or build server.

Nothing in that chain needs a typo, a stolen account or a bug in the package manager. The registry accepts the name because it is free. The installer fetches it because someone asked. Everything rests on one AI hallucination: the model states something false with confidence.

Some pages describe slopsquatting as a typo-based attack. That is a different problem with a different fix. Larson himself listed several ways a developer ends up asking for a package that does not exist: mistyping a name, installing an internal package whose name is free on the public index, or confusing a module name with its package name. Slopsquatting adds one more source of wrong names, and a model can hand the same wrong name to many users.

Slopsquatting vs. typosquatting vs. dependency confusion

Slopsquatting Typosquatting Dependency confusion
Who makes the error A code-generating model A person typing a name A build tool choosing a registry
Where the name comes from Invented by the model A near-miss of a real package An internal package name published publicly
What the attacker needs A name models repeat A popular name to imitate A leaked private package name
Caught by look-alike scanners Rarely Often No; the name is identical

In the USENIX study described below, only 13.4% of invented Python names (10,263 of 76,489) were one or two characters away from a real package. A scanner built for typosquatting attacks, which compares new names to popular ones, would miss most of the rest. A dependency confusion attack is also a separate case: there the name is real and private, and the build pulls a public package with the same name.

How often do AI models invent packages?

The main measurement is “We Have a Package for You!” by Joseph Spracklen and colleagues, presented at USENIX Security 2025 in August 2025. The team generated 576,000 code samples from 16 models in Python and JavaScript. They checked every package name against PyPI and npm lists taken on January 10, 2024.

The paper reports:

  • 19.7% of all package references were hallucinated: 440,445 of 2.23 million.
  • Rates were at least 5.2% for commercial models and 21.7% for open-source models. The best single model, GPT-4 Turbo, scored 3.59%.
  • The models invented 205,474 unique package names.
  • Python averaged 15.8% and JavaScript 21.3%.

The repetition result is what lets an attacker plan ahead. The researchers reran 500 prompts that had produced a fake name ten times each. In 43% of cases the same invented name came back in all ten runs, and 58% repeated more than once. Only 39% never came back.

The models in that study date from 2024. A 2026 follow-up by Aleksandr Churilov (arXiv 2605.17062, version 4, November 9, 2026) reran the same prompts on five newer models in April 2026: Claude Sonnet 4.6, Claude Haiku 4.5, GPT-5.4-mini, Gemini 2.5 Pro and DeepSeek V3.2. It checked names against the live registries.

Its rates were 3.6% to 5.0% of package mentions, or 2.2% to 3.4% of generations. The open-source gap from 2024 had closed, and Python now came out worse than JavaScript for every model.

All five models invented the same 104 names. Fifty-four of those 104 were one edit away from a registered package, so look-alike checks would catch some of the names models share.

The preprint has a single independent author and has not been peer reviewed. Its rates use a different unit and a newer, smaller model set, so do not average them with the 2024 figures.

Read together, the two studies say newer models invent fewer names, and the rate has not reached zero. The author notes that even the best model produced 1,098 invented mentions across 39,969 prompts.

Ten identical photographs of the same lone shop building hang on a line in a darkroom under an indigo safelight

Ask the same question ten times and the same invented name often comes back, which is what makes it worth registering.

What slopsquatting looks like in practice: three registrations

Most of what has happened so far comes from researchers and defenders claiming names before attackers do. The cases differ in what was uploaded, so each is labeled below.

Research registration: huggingface-cli on PyPI. The Register reported on March 28, 2024 that Bar Lanyado of Lasso Security noticed AI models repeatedly suggesting pip install huggingface-cli. The real tool installs with pip install -U "huggingface_hub[cli]".

In December 2023 he uploaded an empty package under that name. By February 2024, Alibaba’s GraphTranslator README told users to install it.

Lanyado said it received more than 15,000 authentic downloads in three months. The package held no code, and he knew of no real attack using the method.

Defensive registration: react-codeshift on npm. On January 14, 2026, Aikido Security researcher Charlie Eriksen claimed react-codeshift, a name that had never been published. His write-up found 237 GitHub repositories already telling agents to run it. He traced it to one October 17, 2025 commit that added 47 LLM-generated agent skills.

Copies of those skills then spread through forks and translations. “Nobody got pwned,” he wrote. The package is now a placeholder. Agents still downloaded it one to four times a day.

A hooded person kneels in fog to drive a stake with a cyan ribbon into an empty lot as another figure carrying stakes approaches

A defensive registration takes an invented name before someone else arrives to use it.

Reported malicious registration: one npm name. The 2026 preprint tracked 2,282 invented names for about six months. Twenty-five were registered, about 1%.

One was an npm name later flagged with a malicious-package report and replaced by npm’s security placeholder. The paper also found at least 23 suggested names that had hosted malware before, which the registries later removed. Those names remain natural targets because the models still suggest them.

None of the sources here describes a company breached through a hallucinated package. As Larson told The Register, “We’re in the very early days looking at this problem from an ecosystem level.” He added that users of LLM-generated code “should be double-checking LLM outputs against reality before putting any of that information into operation.”

Brodie Robertson’s video covers the same research and Lanyado’s experiment for readers who prefer a walkthrough.

Why coding agents raise the stakes

When a person copies a suggestion, there is a pause. They might notice the name looks odd or check the package page.

A coding agent often skips that pause. It writes the install command and runs it in the same step, with whatever access the developer’s machine has.

The react-codeshift case shows a second problem. Agent skill files and README install steps look like documentation, so people copy them without testing them. One invented name in one skill reached 237 repositories.

Socket’s CEO, Feross Aboukhadijeh, described the same shift to The Register in April 2025: developers prompt the AI, copy the suggestion and move on, “or worse, the AI agent just goes ahead and installs the recommended packages itself.” After the name was claimed, the references stayed. Those steady downloads came from agents following instructions no person had read. The same weakness drives prompt injection: the agent acts on text it has no reason to trust.

Unreviewed tools make this worse. If developers use agents the security team does not know about, nobody sets install policies for them. Our guide to shadow AI covers how to find those tools. The broader habit of accepting AI code unread is covered in is vibe coding bad?.

How to stop a slopsquatting attack at install time

A team can block much of this with settings it already has. The steps below target the moment an unknown name turns into running code.

  1. Set a release-age window. A hallucinated name that an attacker has just registered is, by definition, new. Package managers can refuse versions newer than a set age:
    • npm: min-release-age takes a number of days. With it set, npm installs only versions available for longer than that. If none qualify, the install fails. before takes an exact date, and min-release-age-exclude exempts your own packages.
    • pnpm: minimumReleaseAge takes minutes and covers transitive dependencies. The built-in default of 1440 (one day) falls back to newer versions when nothing older matches. Setting it yourself turns on strict mode, which fails instead.
    • uv: exclude-newer accepts a date or a duration such as 7 days or P7D. It compares each file’s upload time.
  2. Install from a committed lockfile in CI. npm ci fails if the lockfile and package.json disagree and never rewrites the lockfile. For pip, --require-hashes installs only the exact files listed in requirements.txt. This stops CI from picking up a new name nobody approved. It does not catch a name added to the lockfile in a pull request.
  3. Fail CI on dependencies that do not exist or are very new. For each newly added dependency, ask the registry when the package was created. If the registry does not know the name, or the first release is days old, stop the build and ask a person. Put this next to your other critical-path checks in CI. Both registries answer this question over a public API, so the check is a short script, shown after this list.
  4. Route production installs through a proxy or allow-list. A private registry proxy that only serves approved packages makes an unknown name fail to install.
  5. Require review for any dependency an assistant or agent adds. Treat a new entry in package.json, pyproject.toml or a skill file the same way you treat new code. Agents can propose packages; a person approves them.
  6. Turn off install scripts where you can. npm’s ignore-scripts stops lifecycle scripts from running at install time, and the npm 11 docs describe an allowScripts policy in package.json for approved packages. A malicious package can still run its code when your program imports it, so this only covers the install step.

A cargo ship waits at anchor at night outside a harbor whose entrance is closed by a barrier

A release-age window keeps new packages waiting outside, the way a ship waits at anchor before it may enter port.

Here is a simple starting configuration. pnpm’s documentation says most malicious releases are found and removed within an hour, so even a one-day window covers that case. A seven-day window also leaves time for slower reports. Adjust the windows to your release process:

For npm, in .npmrc:

min-release-age=7
min-release-age-exclude[]=@your-org/*

For pnpm, in pnpm-workspace.yaml (10080 minutes is seven days):

minimumReleaseAge: 10080
minimumReleaseAgeExclude:
  - '@your-org/*'

For uv, in pyproject.toml:

[tool.uv]
exclude-newer = "7 days"

For step 3, both registries report when a package first appeared. The npm command prints the first publish date or fails with E404. The PyPI request returns 200 if the project exists and 404 if it does not:

npm view some-package time.created
curl -s -o /dev/null -w '%{http_code}\n' https://pypi.org/pypi/some-package/json

Run it only on names that are new in the pull request, and compare the date with your release-age window. A failing check should block the merge and ask the author where the name came from.

A release-age window does not help against a name that was registered months ago. Combine it with steps 4 and 5, which do not depend on timing. It also delays urgent security fixes, which is why each tool has an exclude list.

What model-side fixes can and cannot do

The USENIX team tested fixes on two open models. Retrieval with a list of real packages cut DeepSeek’s rate from 16.14% to 12.24%.

Self-refinement, where the model checks its own answer, cut it to 13.04%. Fine-tuning cut it to 2.66%.

Fine-tuning hurt code quality. DeepSeek’s HumanEval pass@1 score fell from 51.4% to 25.3%, so it solved about half as many benchmark problems. For CodeLlama, fine-tuning lowered the rate from 26.28% to 10.27%, and pass@1 fell from 19.6% to 16.4%.

A better model helps, but even the 2026 results leave a few invented names per hundred mentions. Install-time controls still have to catch the rest.

A five-minute slopsquatting check for your repository

You can run this before changing any settings:

  • List every install command your agents can see. Search agent skill files, README files, setup scripts and CI files for pip install, npx, npm install, uv add and pnpm add. Check that each package named there exists and is the one you expect.
  • Check recent additions. For each dependency added in the last 90 days, look up its first publish date and its maintainer. A brand-new package with one version and no source repository needs a closer look.
  • Look for names that do not resolve. A package your docs mention but the registry does not know is a name anyone can claim. Fix the docs, or register the name yourself if it belongs to your project.
  • Confirm what CI runs. Make sure CI uses npm ci, a frozen lockfile or hash-pinned requirements. A plain npm install can rewrite the lockfile during the build.

Fixing the docs removes the name from circulation; a name you register yourself protects users only while you keep it.

If you also train or tune models on code, the same thinking about where inputs come from applies to training data.