Slopsquatting

Registering package names (or domains — “phantom squatting”) that LLMs predictably hallucinate, so developers and coding agents that trust the model’s suggestion install or fetch attacker-controlled code.

How it works

Term coined by Seth Larson (PSF) in 2025. An LLM predicts a plausible-sounding dependency that does not exist; because hallucinations are repeatable, the attacker only needs to register the name once.

  1. Harvest — prompt models with common coding tasks at scale.
  2. Collect — record non-existent names that recur.
  3. Publish — register them on npm/PyPI with install-time or import-time payloads.
  4. Wait — a developer pastes pip install <name>, or an agent runs it unattended.

Key numbers (UTSA / Virginia Tech / U. Oklahoma study, 16 code-gen models, 576,000 Python/JS samples, 2.23M package references):

  • 19.7% of recommended packages did not exist — 205,474 unique fake names.
  • Open-source models averaged 21.7%; commercial 5.2% (GPT-4 Turbo 3.59%).
  • 43% of hallucinated names repeated across similar prompts; 38% resembled real libraries, 13% were typos of real names, 51% fully invented.
  • ~8.7% of hallucinated Python names were real npm packages — cross-ecosystem confusion.
  • Lower temperature reduced hallucination.

Coding agents amplify it: they install in seconds, often without surfacing the name, across many projects and inside CI. Hallucinated names also propagate through artifacts — READMEs, tutorials, and agent skills that invoke npx <name> — so a wrong name starts to look like consensus. See AI Coding Assistant Risks.

Phantom squatting (domains)

Unit 42 extended the pattern to web infrastructure: LLMs hallucinate brand portals, API endpoints and webhook URLs (e.g. hxxps://api.build-notifier[.]io/v1/pipeline/events) that attackers pre-register. Across 913 brands and 685,339 prompts (2.1M URLs) they found 13,229+ confirmed malicious URLs and ~250,000 still-unregistered hallucinated domains. Newly registered phantom domains have zero reputation, so blocklist/reputation URL filtering misses them; Unit 42 predicted attacker registrations 18–51 days in advance (e.g. the “Montana Empire” phishing kit, flagged 23 days before registration).

Adjacent: LLMO / knowledge injection

North Korea’s Famous Chollima (PromptMink, ReversingLabs) published bait packages with legit functionality and persuasive README text tuned to be chosen by agents — @solana-launchpad/sdk depending on infostealer @hash-validator/v2; later @validate-sdk/v2 with Node SEA payloads, then Rust NAPI-RS add-ons. A hackathon repo added the bait dependency in a commit co-authored by Claude Opus.

Notable cases

  • huggingface-cli (PyPI) — real tool ships in huggingface_hub[cli]; Bar Lanyado (Lasso Security) registered the hallucinated name as an empty package and got 30,000+ downloads in three months; an Alibaba-linked README copied the bad install command.
  • react-codeshift (npm, Jan 2026) — blend of jscodeshift and react-codemod, hallucinated into vibe-coded agent skills (react-modernization, dependency-upgrade) that ran it via npx; spread to 237 repos before Aikido’s Charlie Eriksen claimed it and saw immediate downloads.
  • huggingface-cli-tool — Snyk’s example of a predicted hallucination near the real huggingface-cli.
  • ~800-package npm RAT campaign — OpenSourceMalware describes “AI slop squatted” names delivering WEL1DROPPER.
  • Caveat: the documented huggingface-cli/react-codeshift registrations were benign researcher claims; one source notes no confirmed in-the-wild package slopsquatting attack as of mid-2026, though phantom-domain squatting is confirmed active.

Defenses

  • Treat every assistant-written install line as unreviewed code; verify name, publisher, creation date, repo link and release history on the registry.
  • Route agent and CI installs through an allowlisting proxy registry; unknown package → install fails and the agent must ask a human.
  • Block brand-new packages (hold <30 days, or a shorter release-age gate).
  • --ignore-scripts, sandboxed installs without secrets, exact pins + hashed lockfiles; fail CI on new unapproved deps; diff the build SBOM against the previous build.
  • Pre-install gates such as Aikido SafeChain; combine name distance, package age and maintainer changes rather than any single signal.
  • Maintainers: ask assistants how to install your tool; if they invent a name, register a clearly labeled placeholder pointing to the real package. Publish exact, tested install commands in docs.
  • For phantom domains: don’t trust LLM-generated endpoints in code/config; verify domain ownership and age.

Sources