Slopsquatting, Dependency Confusion and Typosquatting: Dependency Validation for AI-Assisted Changes
Slopsquatting, dependency confusion and typosquatting, each defined from its source, with the 19.7% study read against its method and six dependency checks.

In short
Typosquatting, dependency confusion and slopsquatting are three ways to get a malicious package installed under a name the victim trusts. In typosquatting the name is a near miss of a popular package. In dependency confusion it is the exact name of a private package, published on a public index. In slopsquatting it is a name an AI model invented and an attacker then registered. A USENIX Security 2025 paper measured invented names: 19.7% of the 2.23 million package names that 16 models produced matched no package in registry lists from January 2024. The study carried out no attack. For a change written with an AI coding agent, the working answer is dependency validation: every new name is visible in the diff, looked up by a person, resolved from a known index, pinned by hash and approved by someone named.
Three attacks, each defined by its source
Typosquatting has a registry's own account. In August 2017 the npm registry removed "about 40 packages in total" after a user reported a package called crossenv, a hyphen away from the popular cross-env. The registry wrote that one account had "published a number of packages with names very similar to some popular npm packages", and it called the practice typo-squatting in the same post. The package sent environment variables from the installing machine to a remote server (npm blog, August 2017).
Dependency confusion got its name on February 9, 2021, in a post by the researcher Alex Birsan. He had published public packages under the names of companies' internal packages and logged the callbacks when those names were installed inside the companies. "This type of vulnerability, which I have started calling dependency confusion, was detected inside more than 35 organizations to date, across all three tested programming languages", he wrote of research the companies had permitted (Birsan, archived copy). The documentation of pip, the Python installer, now uses the term in its warning on searching a second index: "This is a class of security issue known as dependency confusion: an attacker can publish a package with the same name to a public index, which may then be chosen instead of your private package" (pip documentation).
Slopsquatting is the youngest term. Andrew Nesbitt posted it on April 8, 2025, with a one-line definition: "when an LLM hallucinates a non-existent package name, and a bad actor registers it maliciously." The same post gives the credit: "Credit to @sethmlarson for the name" (Mastodon). Researchers call the underlying behavior package hallucination, and the paper read below describes it as "a novel form of package confusion attack".
The 19.7% figure, read against its method
Spracklen and colleagues tested code-generating models, 16 for Python and 14 for JavaScript, with two sets of prompts, one drawn from Stack Overflow questions and one generated from the descriptions of popular packages (USENIX Security 2025). Their central result: "These 30 tests generated a total of 2.23 million packages in response to our prompts, of which 440,445 (19.7%) were determined to be hallucinations, including 205,474 unique non-existent packages".
The denominator is package names. The 576,000 generated code samples are the starting material, and the 19.7% is a share of the 2.23 million names collected from them. Names were collected three ways: from install commands in the generated code, which "occur for 7% of the total output", and from two follow-up prompts that asked the model to list the packages a code sample or a task would need. Existence was then checked against lists of PyPI and npm names, "each list is as of 10 January, 2024". A name missing from its list counted as a hallucination. An invented name that someone had already registered would pass as valid, which is why the authors say their results "represent a lower bound of hallucination rate". The 19.7% pools every model tested. The abstract reports the rate separately for commercial and open-source models, and the authors note that the study "includes fewer commercial models due to funding constraints".
A name that comes back on every run is worth more to an attacker, and repetition was measured on a narrower base: Python only, four of the models, and 500 prompts sampled from those that had already produced an invented name. Each prompt was run ten more times. The result: "43% of hallucinated packages were repeated in all 10 queries, while 39% did not repeat at all across the 10 queries."
No package was registered and no install was attempted. The authors report a step they "chose not to pursue for ethical reasons", namely "publishing actual packages using hallucinated package names to PyPI". They also date their own evidence: "Since the writing of this paper, several more advanced models have emerged for code generation."
Two findings bear on defense. On 76,489 invented names from the Python tests, 13.4% sat within one or two character edits of a real package name, and the authors conclude that their results "suggest that most package hallucinations are not simple off-by-one errors". We take that to mean that screening new names for similarity to existing ones, a registry's usual answer to typosquatting, would miss most of these. Checking that a suggested name exists is weaker than it sounds. In the authors' words, "This type of filtering method is ineffective as a defense strategy, as an attacker could immediately publish a hallucinated package to the repository".
We did not find a primary advisory that documents a slopsquatting attack on a named project. The documented case below belongs to the older class, dependency confusion.
One documented case: torchtriton, December 2022
The PyTorch project published its own account on December 31, 2022 (PyTorch advisory). Its nightly builds depended on a package named torchtriton, served from the project's own index. Someone uploaded a package with that name to PyPI. "Since the PyPI index takes precedence, this malicious package was being installed instead of the version from our official repository", the advisory says. It states the general condition just as plainly: "This design enables somebody to register a package by the same name as one that exists in a third party index, and pip will install their version by default."
The advisory bounds the exposure: Linux nightly packages installed through pip between December 25 and December 30, 2022, with the note that "Users of the PyTorch stable packages are not affected by this issue." The malicious copy "added in code that uploads sensitive data from the machine", in a binary that ran "when the triton package is imported, which requires explicit code to do and is not PyTorch's default behavior". The project replaced the dependency with one named pytorch-triton, together with "a dummy package registered on PyPI (so that this issue doesn't repeat)".
A spelling check would have passed torchtriton, and so would an existence check, since the name was right and a package answered to it. What went wrong was the index that answered.
PEP 708, a proposal to address this between Python installers and package repositories, cites the incident and now carries the status Rejected, "because the required conditions for acceptance were never met". Its sentence on the mitigations that exist describes where the work falls: "they all require that the end user go out of their way to protect themselves, rather than being protected by default" (PEP 708).

Dependency validation for an AI-assisted change
An AI coding agent can add a dependency in the same step in which it writes the code that uses it. The person reviewing the change then faces a name they did not choose. In our reading, this is where the engineering bottleneck sits once agents write more of the code: the change arrives in minutes, and someone still has to decide whether to trust it. For dependencies, that decision can rest on six questions, each with an answer the reviewer can find in the record of the change. The questions are the same for a change written by hand.
| Question | Where the answer should already be |
|---|---|
| Does the change add or rename a dependency? | The diff of the manifest and the lock file, called out in the description |
| Did a person look the name up, beyond confirming that it exists? | A note in the review: publisher, first release date, source repository. Existence alone is weak evidence, as the study explains |
| Which index answers for this name? | The installer configuration and, on npm, a scope tied to one registry. From npm's documentation: "We strongly encourage using scoped packages to ensure that a private package isn't being substituted with one from the public registry" |
| Is the exact file pinned? | A lock file with hashes. pip's hash-checking mode "uses local hashes, embedded in a requirements.txt file, to protect against remote tampering and network issues" |
| Does CI install only what the lock file names? | The CI configuration. With npm ci, "If dependencies in the package lock do not match those in package.json, npm ci will exit with an error, instead of updating the package lock" |
| Who approved the new dependency? | The approval on the change, from a named person with authority over that part of the system |
A hash pins the file that was reviewed. Whether the name was the right one to begin with is a separate question, which is why the name check and the pin sit in separate rows.
In software whose failure has consequences, the answers to the six questions belong with the rest of the evidence for the change, in an assurance case. The review checklist for agent-written changes asks in one row whether every new dependency is real, intended and pinned, and the six questions here unpack that row. The provenance checklist covers who and what produced a change. Our article on agentic engineering explains why the decision to accept is now the scarce step.
Where Kealu Vector fits
The Agentic Engineering Assurance Layer is the proposed category for the layer that governs how agentic engineering work is performed and evidenced, so that humans can trust and accept the resulting work. Our white paper AI Has Moved the Bottleneck sets out the problem it answers, and the questions raised here hold whatever tools a team uses to answer them. Kealu Vector, currently designated Vector Assurance Assist, is our early-access implementation of that category.
FAQ
What is slopsquatting?
Slopsquatting is the registration of a package name that an AI model invented, so that anyone who installs the suggested name gets the attacker's code. Andrew Nesbitt posted the term on April 8, 2025 and credited it to Seth Larson. Researchers call the underlying behavior package hallucination. A USENIX Security 2025 study measured it across 16 models and found that 19.7% of the 2.23 million package names they produced matched no package in registry lists dated January 10, 2024. How often anyone goes on to install such a name is outside what the study measured.
What is dependency confusion?
Dependency confusion is an attack in which someone publishes a package on a public index under the same name as an organization's private package, and an installer that searches both indexes can pick the public copy. Alex Birsan named it in February 2021, and the pip documentation now warns about it under that name. The PyTorch nightly incident of December 2022, with the package torchtriton, is a documented case.
What is the difference between typosquatting and slopsquatting?
Typosquatting targets a real, popular package and registers a name close to it, counting on a typing mistake. Slopsquatting targets a name that belonged to no package until an AI model suggested it. The difference matters for defense. npm and PyPI screen new names for similarity to existing ones. In the USENIX study's Python sample, 13.4% of invented names sat within one or two character edits of a real package name.
Does checking that a package exists stop slopsquatting?
An existence check holds only until someone registers the name. The study's authors call this kind of filtering "ineffective as a defense strategy", because an attacker can publish the invented name at any time. A reviewer needs more than existence: who publishes the package, since when, from which source repository, and a hash in the lock file so that later installs fetch the same file that was reviewed.
On Google
Add Kealu as a preferred source: our articles get highlighted in Top Stories, AI Mode and AI Overviews.
Talk to our team.
Questions about this article, or about using Kealu Vector in your organization? Send us a message.
Talk to our team.

