The Ghost Dependencies Lurking in Your Build Pipeline

A new breed of software‑supply‑chain threat has slipped through the door opened by generative‑AI coding assistants. Researchers warn that large‑language models (LLMs) can “hallucinate” package names that do not exist, and opportunistic attackers are already staking claims on those phantom libraries. The practice, now dubbed slopsquatting, could let malicious code ride invisibly into production simply because a developer copied an AI‑generated snippet without checking its imports.
From Typos to “Slops” — How the Attack Works
Traditional typosquatting preys on fat‑finger mistakes, registering look‑alike names such asrequetss
instead of requests
. Slopsquatting flips the script: the names are not misspellings but total fabrications emitted by an LLM trying to satisfy a prompt. When an unsuspecting coder pastes that snippet and hits npm install or pip install, the package manager searches a public registry, finds the attacker’s matching placeholder, and dutifully downloads the booby‑trapped code. Because the name originated in a machine‑generated example, defenders cannot rely on popularity or reputation heuristics to flag it. The dependency is brand‑new, yet its inclusion looks deliberate.
Measuring the Hallucination Problem
A March 2025 study analysed 576,000 Python and JavaScript samples produced by leading code‑generation models. Roughly 20 % of the suggested dependencies were non‑existent. Even the best‑performing commercial model, ChatGPT‑4, hallucinated at a 5 % clip, while open‑source peers such as CodeLlama fared far worse. More than 200,000 unique fake names surfaced, yet 43 % recurred across prompts, proving the noise is repeatable rather than random. Repeatability is exactly what adversaries need; they can scrape public LLM outputs, sort by frequency, and register the hottest imaginary brands before anyone else does.
Why Slopsquatting Scales So Easily
Registering a package is cheap, instant, and rarely audited. Attackers do not need insider access or zero‑days—only a dashboard and a credit card. Because the same hallucinated names keep resurfacing, criminals can focus on a short list of high‑yield targets instead of gambling on random typos. Once published, their payload inherits the full transitive‑trust chain of modern build systems. Continuous‑integration bots will dutifully fetch, cache, and distribute the malware to every downstream environment. The malicious version may never be reviewed by human eyes until an incident response team combs through a breach report months later.
Mitigations: From Temperature Dials to Lockfiles
Socket security researchers suggest lowering an LLM’s temperature setting—the knob that controls randomness—to curb hallucinations. Yet model tuning alone is insufficient. Teams should enforce dependency‑pinning with lockfiles, hash verification, and offline mirrors. Package‑allow‑lists—generated by humans, not AIs—can block imports that stray outside approved boundaries. For critical projects, a private registry that mirrors only vetted releases provides another layer of defense. Finally, treat every AI‑authored snippet as untrusted code: test it inside a sandbox before letting it anywhere near production.
Voices From the Trenches
Hackaday’s community reacted with trademark sarcasm. “Better idea: restrict LLMs to only generate code that uses known libraries,” one commenter quipped, while another retorted that attackers can redefine “known” simply by publishing first. The article’s author, Tyler August, reminds readers that “an AI cannot take responsibility”; the onus to verify imports remains firmly on developers’ shoulders. Meanwhile, security researcher Seth Larson, who coined the slopsquatting moniker, argues that the predictability of hallucinations turns them into “low‑hanging fruit” for adversaries.
Regulatory Ripples on the Horizon
Supply‑chain attacks already top policy agendas after SolarWinds and Log4Shell. Legislators on both sides of the Atlantic are drafting “secure‑by‑design” mandates that could extend liability to vendors who ship AI‑generated code without adequate vetting. Industry groups counter that over‑regulation might stifle open‑source innovation, yet few dispute the need for clearer provenance metadata. Expect SBOM (Software Bill of Materials) standards to evolve, perhaps requiring fields that flag whether a dependency originated from an LLM suggestion and whether a human has validated its existence.
A Checklist for the Next Commit
Before you push that patch generated in a late‑night “vibe coding” session, run through this quick audit:
- grep for new
import
orrequire
lines. - Cross‑check each package on the official registry website.
- Search its release history and maintainer reputation.
- Pin the exact version and verify its checksum.
- Execute unit tests inside a disposable container.
If any step feels like overkill, remember that a single phantom dependency can compromise every customer who pulls your container tomorrow.
The Road Ahead

Generative AI is not leaving the developer toolbox; the productivity gains are real. Yet so are the risks. Slopsquatting illustrates a broader lesson: automation amplifies both creativity and attack surface. The solution is not to abandon AI, but to pair it with equally automated guardrails—dependency scanners, policy‑as‑code gates, and continuous monitoring. In the long run, LLM vendors may incorporate registry look‑ups to refuse fabricating libraries in the first place. Until then, the human in the loop must keep asking one simple question: “Does this package actually exist?”