Slopsquatting: how does a made-up package name get into a PR?
AI models invent package names that don’t exist and repeat them, and attackers register them first. We looked at what stops this at install and in review.
Summary. Slopsquatting is when an AI makes up a package name that doesn’t really exist, and an attacker registers that name first and puts malicious code in it. On 4 November 2026 we read the measurements of five studies, led by the one published at USENIX Security 2025, OWASP’s 2026 list, and the documentation of six package managers and five coding agents.
- Models make up package names, and they repeat the same ones. In the study at USENIX Security 2025, 19.7% of the package names suggested by 16 models were not on the registry; 43% of the made-up names came back every time the same question was asked 10 times.
- 2026 models do it less, but there are names all of them make up. In a preprint (not peer-reviewed), five new models had rates between 4.62% and 6.10%; all five made up the same 127 names, and 53 of those could still be registered.
- Each install setting stops something different. A lock file brings the new name into the diff, and an age threshold stops a newly registered name in its first days; a name registered months ago is stopped only by an allowlist and by review.
- In the end, a made-up name shows up as a line in the pull request. Whether the agent installed the package or you did, check these first: does the package exist and is it the one you meant, who publishes it, how long it has existed, and does its repository match.
What is slopsquatting?
The checklist in the post on reviewing AI-generated code had a line asking whether every function, package and setting the code calls really exists. In the OWASP LLM Top 10 2026 post, we mentioned in a single sentence that assistants make up package names and that attackers register those names in advance. This post looks behind that sentence: how often models make up package names, how such a name gets into a pull request, and what stops it at install time and in review.
Slopsquatting is when an AI suggests a package name that doesn’t exist, and an attacker registers that name first on a package registry such as PyPI or npm and puts malicious code in it. When a model writes you a pip install or npm install line for a package that doesn’t exist, the install normally fails. If an attacker has registered the name, it doesn’t fail: the attacker’s package is installed. OWASP’s 2026 list describes this risk under Supply Chain: coding assistants make up plausible but nonexistent package names at scale, attackers register those names in advance, and an unverified dependency resolves to malicious code. It counts the model’s invention itself under Misinformation.
The word was spread by Andrew Nesbitt on Mastodon on 8 April 2025: he described slopsquatting as “the AI brother of typosquatting” and credited the name to Seth Larson, who works on security at the Python Software Foundation. According to Larson, the name came up in a conversation, and he didn’t expect it to spread so fast. Bar Lanyado had been calling the same thing “package hallucination” since 2023, and Larson wrote that this name was better. The two terms are two links of one chain: package hallucination is the model’s mistake, and slopsquatting is an attacker exploiting it.
Slopsquatting looks like two older attacks but differs from both. In typosquatting, the attacker registers a name very close to a popular package’s and waits for someone to make a typo; that is why PyPI refuses names too similar to an existing project. In dependency confusion, the attacker publishes the name of a company’s internal package on the public registry and waits for the package manager to install it in place of the internal one; that is why npm’s documentation advises you to own your private scope’s name on the public registry too. In slopsquatting, the name is neither a typo nor a leaked internal name. It is a name the model produced on its own.
How often do models make up package names, and why does the same name come back?
The most thorough measurement is the study by Spracklen et al., published at USENIX Security 2025. The researchers had 16 models write 576,000 code samples in Python and JavaScript. Of the 2.23 million package names the models suggested, 440,445, or 19.7%, did not exist on PyPI or npm; among them were 205,474 distinct made-up names. The rate averaged 5.2% for commercial models and 21.7% for open-source models. The models also wrote install lines nobody had asked for: pip install and npm install commands appeared in 7% of the outputs.
For the attack to work, the model has to repeat the same name. The researchers asked 500 prompts that had produced made-up names again, 10 times each. 43% of the made-up names came back in all 10 runs, 39% never came back, and 58% came back more than once. According to the authors, a made-up name that repeats is far more valuable to an attacker. Nor is the mistake random: the authors conclude that even a model set to pick the most likely option at every step keeps producing made-up names.
How you ask matters too. In the same study, prompts about topics from the past year had a rate 10% higher on average. In another study, accepted to EMNLP 2026 (Twist et al.), seven models were asked to use “a library from 2025”; with the worst model, a library that doesn’t exist came up in 85% of tasks. And when a made-up library name was written into the prompt, three of the seven models used it without correcting it in more than 90% of tasks.
The models Spracklen et al. measured came out between mid-2023 and mid-2024. Churilov’s preprint of 16 May 2026 (not peer-reviewed) repeated the same method on five models released between October 2025 and March 2026: two from Anthropic, and one each from OpenAI, Google and DeepSeek. Across 199,845 generations, the rates were between 4.62% and 6.10%; the gap between models had narrowed a lot, but the rate didn’t reach zero. The more important finding: all five models made up the same 127 names (109 on PyPI, 18 on npm), in exactly the same form. An attacker who registers one of these names can reach the users of all five models at once.
The author suggests two reasons. The first is training data: Django REST framework’s package is djangorestframework, but code imports it as rest_framework. Tutorials and posts that mix the two up end up in every provider’s training data, and models write pip install rest-framework. The second is stretching a naming convention too far: names like @ember/service are not published as separate npm packages, but models take them for packages to install. In both cases, models from different providers make the same mistake in the same place.
Not all of these names can be registered. Before publishing the list, the author sent it to PyPI’s security team, and the npm names to the security company Socket. PyPI’s list of prohibited names and its name normalisation rules left 41 of the 109 names open to registration; on npm, 12 of the 18 names turned out to be real candidates. Most made-up names don’t resemble a real package either: of the 76,489 distinct made-up Python names Spracklen et al. examined, only 10,263 (13.4%) were one or two characters away from a real package. A rule that blocks look-alike names can’t apply to the rest.
The experiment that showed a made-up name really getting installed came from a security company. In Bar Lanyado’s research at Lasso Security, dated 28 March 2024, four models were asked 47,803 “how to” questions, and 215 package names turned up that all four made up. Lanyado uploaded an empty package to PyPI under huggingface-cli, a name the models had invented; to tell scanners’ downloads apart, he put a second test package with a meaningless name beside it. By Lasso’s own count, the empty package got more than 30,000 real downloads in three months, and the README of one of Alibaba’s research repositories showed how to install it. Hugging Face’s command-line tool actually comes with the huggingface_hub package.
Fixing this on the model’s side isn’t easy. Spracklen et al. tried three methods, and the most effective was fine-tuning. On one model, it cut the rate of made-up names from 16.14% to 2.66%, but the same model’s score on a coding test (HumanEval) fell from 51.4% to 25.3%. The best of the 2026 models Churilov measured still stayed at 4.62%. According to Churilov, uploading a package is free, so even a rate well below one percent is enough for an attacker. That is why the defence isn’t in the model, but where the package is installed and where the pull request is reviewed.
How does a made-up package name get into a pull request?
All the measurements so far were made by asking the model directly. Churilov writes that he did not measure a coding agent that can look up the registry with its tools, and that such an agent could in principle prevent made-up names entirely. What is certain is this: when a model makes up a name, nothing has happened yet. The name becomes dangerous when someone installs it or writes it into a file. There are four ways this happens:

The first path is the fastest: the agent installs the missing package itself. That is why GitHub leaves package registries open by default in the firewall of Copilot’s cloud agent: so that the agent can download dependencies. npm install writes the name to package.json and package-lock.json, and uv add writes it to pyproject.toml and uv.lock. The second path is a person: a developer who copies an install line seen in a chat or a README. The README in Lasso’s experiment is an example.
On the third path, nobody installs the package: the name is only written into requirements.txt or package.json, and the pull request’s CI job installs it. The code then runs in CI. That is why Codex’s documentation tells you not to set the API key as a job-level environment variable in CI jobs that run the repository’s code: build scripts, tests and dependencies’ install hooks can read it.
On the fourth path, a file gives the agent the name. In a preprint of 7 October 2026 (PackHallu, not peer-reviewed), researchers hid instructions in rules files shared by the community (AGENTS.md, .cursorrules) and got agents to use the attacker’s package in place of a legitimate one. Eight agents, Claude Code and Cursor among them, running with their confirmation steps turned off, used the attacker’s package in working code in 67.68% of tasks on average. Twist et al.’s finding above points the same way.
All four paths end in the same place: a line in the pull request’s diff. It can be a line in a manifest, an import, or a new entry in a lock file. npm’s lock file also records, for each package, the address it was downloaded from (resolved) and the file’s hash (integrity). The install settings are there so that the name never reaches that line; review is there to stop it on that line if it does.
What stops a made-up package at install time?
Three settings help at install time, but each one stops something different. Which one is enough depends on when the name was registered:

A lock file, and an install that doesn’t change it. The lock file records each package’s exact version and hash. In CI, npm ci fails instead of updating the lock file when it doesn’t match package.json, and writes to neither file. pnpm and Yarn do this on their own in CI; in uv, uv sync --locked does the same job, and in Bun, bun ci. In pip, the equivalent is hash-checking mode: with --require-hashes on, a package whose hash isn’t written down doesn’t get installed. These settings don’t stop a made-up name: if the agent installed the package, the name is already in the lock file. What they do is keep the name from entering the pull request without showing up in the diff.
An age threshold (minimum release age). A setting that tells the package manager not to install versions newer than a given age. It actually caught on as a defence against compromised packages: according to pnpm’s documentation, most malicious releases are spotted and removed from the registry within an hour. The first version of a made-up name is a new version too, so the same threshold stops it as well. npm added this setting in version 11.10.0, and pnpm made one day the default in version 11. The line to add, by package manager:
| Package manager | Line to add for an age threshold | Default | Install bound to the lock file in CI |
|---|---|---|---|
| npm | min-release-age=7 (.npmrc) | Off | npm ci |
| pnpm | minimumReleaseAge: 10080 (pnpm-workspace.yaml) | 1440 minutes; installs anyway if no version is old enough | pnpm install --frozen-lockfile |
| Yarn | npmMinimalAgeGate: "1w" (.yarnrc.yml) | Not stated in the documentation | yarn install --immutable |
| Bun | minimumReleaseAge = 604800 (bunfig.toml, [install]) | Off | bun ci |
| uv | exclude-newer = "7 days" (pyproject.toml, [tool.uv]) | Off | uv sync --locked |
| pip | --uploaded-prior-to P7D (pip install) | Off unless the flag is passed | pip install --require-hashes |
Source: the package managers’ documentation, 4 November 2026. Every example line is a one-week threshold: npm reads days, pnpm minutes and Bun seconds. pnpm and Yarn don’t change the lock file in CI even without this flag. “Not stated in the documentation”: in the pages we read that day, we found no sentence that describes this. When pnpm’s default finds no version past the threshold, it falls back to a newer one; once you write the line into pnpm-workspace.yaml yourself, the install stops in that case. In pip the same setting can also be given as the environment variable PIP_UPLOADED_PRIOR_TO, and in uv as UV_EXCLUDE_NEWER.
The age threshold’s limit is plain: it only stops a name registered recently. Lasso’s huggingface-cli package was downloaded for three months; a one-week threshold would have let it through after its first week. A name on Churilov’s list could likewise be registered today and left to wait a week. Dependabot (by default 3 days) and Renovate apply a similar wait, but only to updates of packages you already use; a new name an agent adds doesn’t go through them.
A dependency’s install script. Malicious packages often run their code at install time: according to pnpm’s documentation, most compromised packages did it with a postinstall script, the moment they were installed. On the JavaScript side, none of the four package managers runs these dependency scripts by default: since npm 12, npm blocks any that aren’t on the allowScripts list, pnpm runs none that aren’t in allowBuilds, Bun none that aren’t in trustedDependencies, and in Yarn, enableScripts is off by default. Python is different: according to pip’s documentation, an install runs code from inside the distributions by default. --only-binary :all: refuses source packages (sdists), and the uv equivalent is no-build. These settings keep code from running at install time, but the package’s code still runs when it is imported.
An allowlist, or an internal package registry. An age threshold doesn’t stop an old name, and a script setting doesn’t stop an import. The way to never install an unapproved package is to point installs at a registry that serves only the packages you approved. The Open Source Security Foundation’s (OpenSSF) supply chain framework, S2C2F, calls this a curated feed and asks that developers take no packages from outside it; according to Microsoft, which first drew up the framework, the company has used it since 2019. The list should hold the packages you approved, not every package that exists on the registry: as Spracklen et al. write, an attacker can register a made-up name right away, so checking “is it on the registry?” is no defence on its own. Coding agents have the same setting: in Copilot’s firewall, you can turn off the recommended list and add your own registry’s domain instead, and in Claude Code’s cloud environment, you can give your own list of domains at the Custom access level.
What does your coding agent do when it installs a package?
An agent can install a package in two places: on your own machine and in the cloud. These are the defaults we read in five tools’ documentation on 4 November 2026:
| Tool | On your machine | In the cloud |
|---|---|---|
| Claude Code | Asks for approval before a shell command, except read-only ones. The sandbox is off by default; when it is on, it also asks the first time a command connects to a new domain | The default access level is Trusted: package registries such as npm, PyPI, RubyGems and crates.io are open |
| Codex | No network in the default sandbox; asks for approval before a command that needs the network | In the environment settings, you open either the whole internet or the package managers’ domains |
| GitHub Copilot | The CLI asks for approval before a command that isn’t already allowed; the local sandbox is off by default, and a command reaches any network your machine can reach | The firewall is on; the recommended allowlist is on by default too, and it includes the languages’ package registries |
| Cursor | In the recommended Auto-review mode, a command runs in the sandbox when possible, without asking; the sandbox’s default network list includes common package managers | Internet access is on by default; the agent runs every terminal command without asking |
| Antigravity CLI | In auto mode, the sandbox is on and has no network; a command that has to run outside it goes through an automatic evaluation, and an irreversible one is put to you | The remote agent runs commands without asking for approval by default |
Source: the tools’ documentation, 4 November 2026. Codex’s current cloud environments page doesn’t state the default; in the old Codex Cloud (Legacy), internet access is off by default during the agent phase, and setup scripts run with internet access. Antigravity CLI’s auto mode is the default where it is available; the remote agents page doesn’t describe network access.
In three of the five tools, the cloud agent reaches package registries by default. Claude Code and Copilot leave them open so that the agent can download dependencies. In Cursor’s cloud agent, the internet is open anyway and the agent runs every terminal command without asking, so a package it installs can travel all the way into the pull request it opens without anyone asking you. We covered where cloud agents run and whose permissions they act with in the cloud agents post.
On your own machine, the agent’s approval prompt is a small chance to review: before you approve the name in an npm install line, check that the package really exists and is the one you meant. Be careful when you make an approval permanent. Copilot CLI’s documentation shows with an example that approving a tool for the session approves every use of that tool: approve an rm command that way, and you have approved every rm command for the rest of the session. Outside these five tools, in OpenCode, most permissions are “allow” unless you specify otherwise: the agent runs commands without asking.
A sandbox protects your machine, but it doesn’t keep the package out of the pull request. The sandboxes of Claude Code and Cursor allow writes to the working folder; a package installed in the sandbox is written to package.json and the lock file too, and makes it all the way into the pull request. We covered what a sandbox limits in detail in the sandbox post.
What should you check when a pull request adds a new dependency?
Every path ends in a line in the diff, and review is the last place to stop that line. OWASP asks you to verify two things before adding a dependency an AI suggested: does the package really exist, and is it the package you meant. OpenSSF’s guide to evaluating open source software spells this out in a few questions. Put the two together, and you get these six questions:

OpenSSF’s guide recommends verifying that the package is the authentic one from the authorised source, and checking its name, its project website, when it was created and how widely it is used to do so; if a more popular package has a similar name, it counts that as a sign of typosquatting. It also lists looking for malicious code in install scripts and not adding an unnecessary dependency at all. The line in the post on reviewing AI-generated code that asks whether a package the code calls really exists is the first of these six questions.
Most of this is one command away. On npm, npm view shows when each version was published, the package’s repository and its maintainers; on PyPI, the JSON API gives each release’s upload time and the project’s links. PyPI also marks the links it verified at upload time. On npm, provenance is a verifiable link from the package to its source code and its build; npm’s documentation also says plainly that it doesn’t guarantee the package contains no malicious code.
npm view package-name time repository.url maintainers
curl -s https://pypi.org/pypi/package-name/jsonYou don’t have to do this by hand on every pull request. GitHub’s dependency review shows, on a pull request that changes a manifest or a lock file, the dependencies added, removed and updated, with their release dates and how many projects use them; dependency-review-action turns this into a check in CI and, by default, fails when it finds a package with a known vulnerability. We covered where dependency scanning sits in CI in the AI security scanning post. Installing an agent skill is adding a dependency too; we covered how safe it is to install someone else’s skill in the agent skills post.
Our AI code review tool, diffox, reads a pull request’s change together with the repository at its latest commit. Where the change would break a build, an install, a test run or a deployment, it writes a comment on the changed line that causes the problem, after reading the code that proves it; dependencies is one of its comment categories. Each finding is classed as Critical, Warning or Suggestion, and diffox never blocks a merge. Next to your package manager’s settings and the six questions above, this is the layer that looks at what the change breaks in the rest of the repository.
Frequently asked questions
What is slopsquatting?
It is when AI models suggest a package name that doesn’t really exist, and an attacker registers that name first on a package registry such as PyPI or npm and puts malicious code in it. When the model suggests the same name to other users, the install doesn’t fail: the attacker’s package is installed. The word came out of a conversation of Seth Larson’s in April 2025, and OWASP LLM Top 10 2026 describes the risk under Supply Chain. In a study published at USENIX Security 2025, 19.7% of the package names models suggested were not on the registry.
What is the difference between slopsquatting and typosquatting?
Typosquatting bets on a person’s typo: the attacker registers a name very close to a popular package’s. Slopsquatting bets on the model’s invention: the name isn’t a typo but one the model produces again and again. In Spracklen et al.’s measurement, only 13.4% of the distinct made-up Python names were one or two characters away from a real package, so registry rules that block look-alike names can’t stop most of them. Dependency confusion is a third kind: the attacker publishes the name of a company’s internal package on the public registry.
Why does AI suggest packages that don’t exist?
A model doesn’t produce a package name by looking it up on a registry, but from patterns it saw in its training data. According to a 2026 preprint, two patterns stand out: taking the name imported in code for the package’s name (writing djangorestframework as rest-framework, for example), and stretching a naming convention to packages that were never published. New topics raise the risk too: in the USENIX Security 2025 study, prompts about topics from the past year had a rate 10% higher on average. And because 43% of the made-up names came back every time the same question was asked 10 times, an attacker can register those names in advance.
What is a minimum release age?
A setting that tells the package manager not to install versions published more recently than a given age. In npm you write it in .npmrc as min-release-age=7 (days), in pnpm in pnpm-workspace.yaml as minimumReleaseAge (minutes), and in uv in pyproject.toml, under [tool.uv], as exclude-newer = "7 days"; Yarn, Bun and pip have an equivalent. Since pnpm 11, the default is 1440 minutes, but if no version is old enough, it installs the package anyway; once you write the line yourself, the install stops. The setting stops a made-up name registered recently, not one registered months ago.
Can a coding agent install a package on its own?
Yes. On your own machine, Claude Code, Codex and Copilot CLI ask for approval before a shell command by default; Cursor’s recommended Auto-review mode can run the command in the sandbox without asking, and the sandbox’s default network list includes package managers. In OpenCode, most permissions are “allow” by default. In the cloud, the agents of Claude Code and Copilot reach package registries by default, and Cursor’s cloud agent runs every command without asking. A package the agent installs is written to package.json and the lock file, and shows up in the pull request.
Are package hallucination and slopsquatting the same thing?
They are two links of one chain. Package hallucination is a model producing a package name that doesn’t exist; slopsquatting is an attacker registering that name and using it. Bar Lanyado started using the first term in 2023, and the second came out of a conversation of Seth Larson’s in April 2025. OWASP LLM Top 10 2026 draws the same line: it covers the invention under Misinformation and the registration of the name under Supply Chain. If you want to test the model you use, garak, an open-source LLM vulnerability scanner, has a probe that measures this.
What does diffox look at in a pull request that adds a new dependency?
At what the change breaks in the rest of the repository. diffox reads a pull request’s change together with the repository at its latest commit; where a build, an install, a test run or a deployment would break, it writes a comment on the changed line that causes the problem, after reading the code that proves it, and dependencies is one of the categories of those comments. Findings are classed as Critical, Warning or Suggestion; diffox never blocks a merge.