package hallucination
A coding model recommending a dependency that does not exist, which an attacker can then register with malicious code.
Installing a registered hallucinated name runs the attacker's code on developer machines and in CI.
In more detail
A study presented at USENIX Security found that at least 5% of packages suggested by commercial models, and far more from open ones, did not exist. Check every new dependency against the registry and an approved list before installing.
Related terms
- typosquatting — Registering a name that differs from a popular one by a small typing mistake, such as a lookalike domain or package name, to catch people who mistype it.
- dependency gate — A check in CI or a pre-commit hook that decides every new dependency: blocked if it is missing from the registry or looks like a typosquat, reviewed if unapproved, pinned if approved.
- hallucination — Output from a model that is fluent and confident but false or unsupported, such as an invented fact, citation, function or package.
Taught in
- Working With AI Coding Assistants — AI Engineering: LLM Apps, RAG & Agents
References
- Spracklen et al., We Have a Package for You! A Comprehensive Analysis of Package Hallucinations by Code Generating LLMs (USENIX Security 2025)
- PyPI JSON API