Slopsquatting: One in Five AI Code Samples Suggest a Nonexistent Package
llama open-source
| Source: Dev.to | Original article
Around 20% of AI-generated code samples recommend non‑existent packages, a practice researchers label “slopsquatting.”
A new study presented at USENIX Security 2025 uncovers a worrying pattern in AI‑generated code: almost one‑fifth of the package dependencies suggested by large language models (LLMs) simply do not exist. The researchers, who produced 576,000 code samples across 16 different models, found that 19.7 % of the recommended packages were fabricated. Open‑source models were the most prone to the error, hallucinating non‑existent packages in 21.7 % of cases, while proprietary, black‑box offerings averaged just 5.2 % [1][9].
The phenomenon, dubbed “slopsquatting,” builds on classic typosquatting but removes the human typo altogether. An AI assistant inserts a bogus package name, and an attacker can pre‑emptively register that name, turning a harmless suggestion into a supply‑chain foothold. The term was coined by Seth Larson of the Python Software Foundation, who warned that the attack vector requires no user mistake—only the model’s slip [2].
Why it matters is twofold. First, developers increasingly rely on AI coding assistants for dependency selection, meaning hallucinated packages could be pulled into production unnoticed. Second, the disparity between open‑source and proprietary models suggests that the choice of tooling directly influences exposure to this risk. CodeLlama variants, for example, were among the models with higher hallucination rates [1][9].
The findings are already prompting calls for tighter validation of AI‑suggested dependencies and for tooling that can flag or block unknown packages before they are fetched. Watch for industry responses, including updates to package registries, new detection mechanisms in AI assistants, and possible regulatory guidance on AI‑driven software supply‑chain security.
Sources
Back to AIPULSEN