LLMs, and the coding tools they power, have a tendency to recommend packages that do not actually exist. Research has found that these hallucinated package names are sometimes repeated across scenarios and even across models. Attackers observe the names that recur and pre-register them on public registries. When a developer or an AI agent installs one, malicious code runs.
Why this is a repeatable risk
USENIX Security research found that hallucinated package names recur, which makes this a repeatable supply-chain attack rather than a one-off. Vibe coders are especially exposed because they are unfamiliar with common packages and unlikely to spot a fake.
How to defend your build
- Verify before installing. Check the registry page, publisher, release history, and repository for every dependency.
- Pin exact versions. Avoid
latestand floating ranges. - Run dependency audits in CI. Block merge on known vulnerabilities.
- Review AI suggestions. Treat each suggested import as a decision, not a default.
- Use a private registry or allow-list for production builds where feasible.
Run the 24-point checklist → See the production readiness audit →