DevelopmentPlaybook10 min readPublished July 19, 2026

Hallucinated dependencies · 205K+ fake names in one study · 43% repeat every single run

Slopsquatting: When AI Invents Packages Attackers Own

AI coding tools recommend packages that don't exist — 19.7% of the time across a 576,000-sample academic study — and attackers have learned to register those exact names. Slopsquatting is not typosquatting with a new coat of paint: the names aren't misspellings, so registries have no similarity heuristic to catch them. Here is how the attack works and the layered defense that closes it.

DA
Digital Applied Team
Senior strategists · Published Jul 19, 2026
PublishedJul 19, 2026
Read time10 min
Sources6 primary sources
Recommended packages that don't exist
19.7%
576K samples · 16 models
Unique hallucinated names
205K+
one study corpus
Repeated in all 10 re-runs
43%
persistence experiment
Open-source vs commercial gap
~4x
21.7% vs 5.2% avg rates

Slopsquatting is the supply-chain attack built for the AI coding era: a language model hallucinates a plausible-sounding package name that has never existed, an attacker registers that exact name on npm or PyPI, and the next developer — or autonomous coding agent — who copy-pastes the install command pulls the attacker's code straight into the build.

The scale of the raw material is what makes this different from every squatting attack before it. The foundational academic study found that 19.7% of packages recommended by code-generating LLMs simply don't exist — more than 205,000 unique fictional names in a single research corpus. And because hallucinations are persistent rather than random, attackers can farm them: run the same prompts, collect the names that repeat, register them, and wait.

This playbook covers what slopsquatting is and who named it, the research numbers that define the attack surface, why registries structurally cannot catch it, the named cases reported so far, how it differs from typosquatting and dependency confusion, and the layered defense — lockfiles, existence verification, provenance, and mandatory human review of agent-generated dependencies — that actually closes the gap.

Key takeaways
  1. 01
    AI tools recommend non-existent packages at scale.Across 576,000 generated code samples and 16 models, 19.7% of recommended packages were hallucinated — over 205,000 unique fake names. Open-source models averaged 21.7% vs 5.2% for commercial ones, roughly a 4x gap.
  2. 02
    Hallucinations are farmable, not random noise.Re-running 500 hallucination-triggering prompts 10 times each, 43% of fake names reappeared in every single run. Predictable output means attackers can harvest names to register before anyone types the install command.
  3. 03
    Registries have no heuristic that catches it.Only 13% of hallucinated names are near-typos of real packages; roughly 49% are highly dissimilar from anything real. Similarity-based typosquat detection never fires, and once an attacker registers the name, the package is real.
  4. 04
    Real cases are already documented.Aikido Security's February 2026 write-up reports a malicious unused-imports npm package, a react-codeshift name spread across 237 repositories via agent-authored instructions, and recounts the earlier huggingface-cli PyPI case with 30,000+ installs.
  5. 05
    The defense is layered, and most of it already exists.Lockfiles with npm ci, registry-existence verification before any new install, Sigstore-backed provenance checks, private registry proxies, and human review of every agent-added dependency. No single control is sufficient; the stack is.

01The AttackA name invented by AI, owned by an attacker.

The term was coined by Seth Larson, Developer-in-Residence at the Python Software Foundation, and popularized by Ecosyste.ms creator Andrew Nesbitt — a portmanteau of "AI slop" and "typosquatting." The mechanics are simple. An AI coding assistant, asked to solve an ordinary problem, confidently suggests importing a package and installing it. The package doesn't exist — yet. A threat actor who knows which names models tend to invent registers one of them, publishes malicious code under it, and from that moment the hallucination resolves. The install command that would have failed with a 404 last week now succeeds, silently, with the attacker's payload.

What elevates this from curiosity to attack class is the automation on both sides. Developers increasingly accept AI-suggested dependencies without manually checking the registry, and autonomous coding agents can run install commands with no human in the loop at all. Socket.dev's editorial team, which published the definitive early analysis in April 2025, argued that slopsquatting is not just a clever term — researchers had demonstrated a serious, emerging threat in an ecosystem already strained by supply-chain complexity and volume.

Why the old defenses don't transfer
Writing in VentureBeat in July 2026, ReHack features editor Zac Amos made the structural point: because hallucinated packages are not simply typoed versions of popular libraries, the protections registries built against typosquatting offer no defense against this practice at scale — and developers who lean on AI assistants without verification can be granting attackers access to their software from day one.

02The Evidence576,000 samples, 16 models, one in five recommendations fake.

The foundational dataset comes from "We Have a Package for You! A Comprehensive Analysis of Package Hallucinations by Code Generating LLMs" — Spracklen et al., a joint study by researchers at the University of Texas at San Antonio, Virginia Tech, and the University of Oklahoma. The team tested 16 code-generation models, commercial and open-source, generating 576,000 Python and JavaScript code samples across 30 test runs. The headline result: 19.7% of all recommended packages were hallucinated, producing more than 205,000 unique non-existent package names.

The spread between model families is the operationally important detail. Commercial models averaged a 5.2% hallucination rate; open-source models averaged 21.7% — roughly a 4x gap. GPT-4 Turbo posted the study's best rate at 3.59%, while CodeLlama 7B and 34B hallucinated in over a third of their outputs. VentureBeat's July 2026 coverage separately cites DeepSeek at 13.63% — note that this is a single-model rate from the same comparative dataset, not a category average, so it sits comfortably inside the 21.7% open-source mean rather than contradicting it. The same coverage reports the roughly 4x proprietary-vs-open gap has persisted into 2026.

Package hallucination rate by model family

Source: Spracklen et al. (arXiv:2406.10279) via Socket.dev; DeepSeek figure via VentureBeat. Bar lengths scaled to the worst rate.
CodeLlama 7B / 34BWorst offenders · hallucinated in over a third of outputs
>33%
Open-source model averageAcross the open-source cohort
21.7%
All 16 models combined576K samples · 30 runs · Python + JavaScript
19.7%
DeepSeek (single model)Best open-source rate cited via VentureBeat
13.63%
Commercial model averageAcross the commercial cohort
5.2%
GPT-4 TurboLowest rate in the original study
3.59%

Two secondary findings sharpen the risk picture. Higher temperature settings — the randomness dial many teams turn up for "creativity" — increased hallucination rates, to the point where some models generated more fake packages than real ones. And verbose models that recommend more unique packages per answer hallucinated more. If your team runs open-source models at high temperature for code generation, you are operating at the worst corner of this distribution.

03The Detection GapConvincing, persistent, and invisible to similarity checks.

Registries and security scanners caught up to typosquatting by measuring string distance: a package one keystroke away from a popular name is suspicious by construction. Slopsquatting breaks that model. The Spracklen team's Levenshtein-distance analysis found only 13% of hallucinated names were simple off-by-one typos. 38% had moderate similarity to real packages, and nearly half — roughly 49% — were highly dissimilar: fully fabricated names that are nonetheless contextually believable, because the model composed them from the naming conventions of the ecosystem.

The persistence data is what turns a quality problem into an attack surface. Re-running 500 hallucination-triggering prompts ten times each, 43% of hallucinated packages repeated in every single run, 58% repeated in more than one run, and 39% never reappeared. A stable minority of hallucinations behaving like deterministic output means an attacker doesn't need luck — they can enumerate the names a popular model reliably invents and register the most convincing ones.

Persistence
Repeat in all 10 re-runs
43%

Hallucinated names that reappeared every single time the same prompt was re-run. Predictable output is harvestable output — attackers can farm the exact names to register.

58% repeat in >1 run
Believability
Fully fabricated names
~49%

Nearly half of hallucinated names were highly dissimilar from any real package under Levenshtein analysis — invisible to the string-similarity heuristics that catch typosquats.

Only 13% near-typos
Cross-ecosystem
Python names that were real npm packages
8.7%

LLMs sometimes cross-confuse ecosystems, recommending valid JavaScript package names in Python contexts. Only 0.17% matched real-but-deleted PyPI packages — the rest are pure fiction.

0.17% deleted-pkg matches

One partial bright spot from the same research: some models can detect their own hallucinations with over 75% accuracy when asked to review their prior output — GPT-4 Turbo and DeepSeek performed best at this. Self-review is a useful mitigation layer, and it maps directly onto how agentic pipelines should be built: a verification pass over generated dependencies before anything is installed. But 75%+ accuracy still leaves a meaningful miss rate, which is why it belongs inside a layered defense rather than as the defense.

A typosquat exploits your fingers. A slopsquat exploits your trust in the machine that types for you — and by the time the fake name is registered, the registry sees a perfectly real package.— Digital Applied engineering analysis

04In the WildNamed cases — as reported by Aikido Security.

How much of this is theoretical? A February 2026 write-up from Aikido Security documents named real-world cases. One caveat we apply deliberately: these incidents come from a single vendor source and have not been independently cross-confirmed in our research pass, so treat the specifics — download counts, repository spread — as Aikido's reporting as of February 2026, not as continuously verified figures.

npm · reported Feb 2026
unused-imports
~233 weekly downloads at time of report

A malicious npm package squatting a name AI tools hallucinate for the real eslint-plugin-unused-imports. Per Aikido, it was still recording roughly 233 weekly downloads as of early February 2026 despite being flagged.

Real plugin: eslint-plugin-unused-imports
npm · reported Jan 2026
react-codeshift
Found across 237 repositories

A hallucinated name conflating the real jscodeshift and react-codemod tools. Aikido reports it spread across 237 repositories via AI-agent-authored instructions — with agents still attempting installs daily at discovery time.

Conflates jscodeshift + react-codemod
PyPI · early-2024 case
huggingface-cli
30,000+ installs over three months

The best-documented earlier case, recounted in the same write-up: AI models repeatedly suggested this non-existent install path, a researcher registered it, and the name drew 30,000+ installs — even landing in an Alibaba public repository README.

Registered as a harmless proof-of-concept

The huggingface-cli case is the cleanest illustration of the mechanic, because the correct command was never a package install at all — it is pip install -U "huggingface_hub[cli]". The model collapsed a CLI extra into a package name that sounded right, and tens of thousands of installs followed. The react-codeshift case adds the agentic twist: the fake name propagated through instructions that AI agents themselves had written into repositories, creating a loop where machine-generated documentation feeds machine-executed installs with no human checkpoint in between.

05Attack ComparisonTyposquatting vs dependency confusion vs slopsquatting.

Most coverage explains slopsquatting in isolation. The more useful exercise is laying the three squatting-family vectors side by side, with the column that matters most: what the registry can actually detect, and the specific control that closes each gap. The verdicts below synthesize Socket.dev and VentureBeat's attack definitions with npm's provenance documentation and Trend Micro's mitigation guidance.

Comparison of typosquatting, dependency confusion, and slopsquatting: attack mechanism, documented example, whether the registry can auto-detect the attack, and the control that actually stops it. Synthesis by Digital Applied from Socket.dev and VentureBeat definitions, npm provenance documentation, and Trend Micro mitigation guidance, July 2026.
AttackHow it worksDocumented exampleRegistry auto-detects?What actually stops it
Human-error vectors (pre-AI)
TyposquattingAttacker registers a near-miss spelling of a popular package and waits for fat-fingered installs.A one-keystroke variant of a top-downloaded npm or PyPI package name.Partially — name-similarity heuristics can flag near-collisions with popular packages.Similarity scanning, dependency review, and copy-pasting install commands from official docs only.
Dependency confusionAttacker publishes a public package with the same name as a private internal one at a higher version, so resolvers prefer the public copy.A public clone of an internal company utility name pushed to the open registry.No — the name itself is legitimate; the failure is in resolution order, which the registry cannot see.Scoped package names, a private registry proxy with explicit upstream rules, and pinned resolution.
AI-era vector
SlopsquattingAn LLM hallucinates a plausible package name that never existed; the attacker registers that exact name and waits for developers or coding agents to install it.unused-imports, react-codeshift, and the earlier huggingface-cli case — all as reported by Aikido Security.No — only 13% of hallucinated names are near-typos and roughly 49% are highly dissimilar from any real package, so similarity heuristics never fire.Registry-existence verification before install, lockfiles with npm ci, provenance checks, and human review of every agent-added dependency.

The pattern the table exposes: each generation of squatting attack moved the exploitable error one step further from the registry's field of view. Typosquatting exploits a keystroke the registry can approximately model. Dependency confusion exploits resolution order the registry never sees. Slopsquatting exploits a hallucination that happened inside a model's forward pass — there is nothing on the registry side to inspect until the attacker registers the name, at which point it looks like any other new package. One adjacent vector worth distinguishing: the AsyncAPI npm attack of July 14, 2026 trojanized four legitimate, established packages — a compromise of real supply, not a registration of fake supply. Different vector, overlapping defense stack.

06The PlaybookThe layered defense, in adoption order.

No single control stops slopsquatting, because the attack spans model output, developer behavior, and registry state. The stack below is sequenced by effort-to-payoff — the first two layers need no new tooling, only discipline in files and commands your team already uses.

Layer 1 · lockfiles
Lockfile discipline + npm ci

Commit the lockfile and run npm ci — never bare npm install — in CI. A locked dependency tree means a hallucinated name suggested mid-task cannot silently enter a build; it must arrive as a reviewable lockfile diff.

Adopt everywhere first
Layer 2 · verification
Existence + age checks before install

Before any new dependency is added — by a human or an agent — verify it exists on the registry, check its age, download history, and maintainer. A package registered last week with near-zero history answering to an AI-suggested name is the exact slopsquat profile.

The slopsquat-specific control
Layer 3 · provenance
Sigstore provenance attestations

npm supports cryptographic provenance (npm publish --provenance, CLI 9.5.0+), linking a package version to its exact source commit and CI build, recorded in Sigstore's public Rekor transparency log. Prefer attested dependencies and verify them in CI.

Detection layer, not prevention
Layer 4 · policy
Registry proxy + human review

Route installs through a private registry proxy with allowlisting so unknown names can't resolve directly from the public registry, and make human review of every agent-added dependency a merge-blocking rule, not a suggestion.

The backstop for agents
Provenance is not a silver bullet
Provenance proves origin, not safety. npm's own documentation frames attestations as transparency — a verifiable, tamper-evident link between package, commit, and build system — not a malware-free guarantee. Security research in 2026 has shown the general finding holds in practice: attacker-published packages can carry valid provenance. Treat provenance as a detection and audit layer inside the stack above, never as the reason to skip the other layers.

The agent-side story matters just as much as the registry-side one. Recent Trend Micro research frames the core failure modes as context-gap filling and surface-form mimicry: agents compose plausible package names either by filling in what they assume must exist, or by statistically following naming conventions, without verifying against a real registry. The same research notes that even advanced coding agents with MCP-backed, real-time validation — Claude Code CLI, OpenAI Codex CLI, Cursor — reduce but do not eliminate phantom-dependency risk, because validation cannot catch every edge case. That is the design argument for Layer 4: the human review gate exists precisely for the residue the automated layers miss. Teams formalizing this should fold it into their broader enterprise vibe-coding security practices rather than treating it as a standalone rule.

07The Bigger PictureWhy this compounds in the agentic coding era.

The adoption math is what gives slopsquatting its trajectory. Per a 2025 State of Code survey cited by VentureBeat, over 40% of code committed by developers using AI tools is estimated to include AI assistance, and 72% of those who have tried AI coding tools use them daily. Meanwhile a 2026 vulnerability-lifecycle study of 31,267 vulnerabilities across 14,675 packages in 10 languages found reported vulnerabilities growing at roughly 98% per year — far outpacing the roughly 25% annual growth in open-source package counts — with an 85% increase in average vulnerability lifespan. More AI-authored code, flowing into an ecosystem whose vulnerability curve is already steepening, with a dependency channel the registry cannot police by similarity: that is the compounding structure.

Our read of the trend: slopsquatting inverts the economics that kept typosquatting a nuisance rather than a crisis. A typosquatter guesses at human error; a slopsquatter reads a distribution. Because 43% of hallucinated names repeat deterministically, the attacker's targeting problem is solved by the models themselves — and every increment of agent autonomy removes another human checkpoint between the hallucination and the install. The react-codeshift pattern, where agent-authored instructions seeded fake names across 237 repositories, is the early shape of that loop.

Looking forward, expect the verification burden to migrate into the agent toolchain itself: registry-existence and package-age checks as first-class tool calls, provenance verification in CI by default, and agent frameworks shipping install-gating policies the way browsers ship safe-browsing lists. The self-review finding — models catching their own hallucinations at better than 75% accuracy — suggests the cheapest near-term win is architectural: make every agent second-guess its own dependency suggestions against the live registry before the install step, and escalate anything new or low-history to a human. How platform vendors structure disclosure and hardening incentives around agent security — AI agent security and bug-bounty programs included — will shape how fast that becomes standard. For teams building agentic development pipelines now, this is exactly the class of guardrail our AI transformation engagements design in from day one rather than bolting on after an incident.

08ConclusionTrust the model's code less than its imports.

The bottom line, July 2026

Slopsquatting turns AI hallucination into attacker infrastructure — and only layered, boring controls stop it.

The numbers define the problem precisely: roughly one in five AI-recommended packages doesn't exist, 43% of those hallucinations repeat on demand, and about half look nothing like any real package a similarity scanner could flag. That combination — abundant, predictable, undetectable-by-heuristic — is why slopsquatting deserves its own row in your threat model rather than a footnote under typosquatting.

The defense is unglamorous and largely already in your toolchain: committed lockfiles with npm ci, an existence-and-age check before any new dependency lands, Sigstore provenance as an audit layer, a registry proxy for resolution control, and a merge-blocking human review on every agent-added dependency. None of these is novel; the discipline of running all of them together is.

The deeper shift is cultural. AI-generated code gets reviewed for logic; AI-generated dependency lists too often get executed on trust. In the agentic era, the import statement is the attack surface — treat every new name a model proposes as unverified input from the internet, because that is exactly what it becomes the moment an attacker registers it.

Ship agentic development safely

Agent velocity without supply-chain exposure is a design choice.

Our team helps engineering and marketing organizations adopt AI coding agents with the guardrails built in — dependency verification, CI provenance checks, and review gates — so velocity gains don't arrive with supply-chain exposure.

Free consultationExpert guidanceTailored solutions
What we work on

AI development guardrail engagements

  • Agent toolchain hardening — install gating & registry checks
  • CI supply-chain controls — lockfiles, npm ci, provenance
  • Dependency review workflows for agent-generated code
  • Private registry proxy & allowlist architecture
  • Incident-readiness for npm / PyPI supply-chain events
FAQ · Slopsquatting defense

The questions we get every week.

Slopsquatting is a software supply-chain attack in which threat actors register package names that don't exist but that AI coding tools tend to hallucinate — then wait for a developer or an AI coding agent to copy-paste an install command for the fake name without checking that it's real. The term is a portmanteau of 'AI slop' and 'typosquatting,' coined by Seth Larson, Developer-in-Residence at the Python Software Foundation, and popularized by Ecosyste.ms creator Andrew Nesbitt in a 2025 social post. The attack differs from typosquatting in a crucial way: the fake names aren't misspellings of real packages, they are plausible fabrications composed from ecosystem naming conventions, which makes them invisible to the similarity-based detection registries use against typosquats.
Related dispatches

Continue exploring supply-chain defense.