Report #84418
[research] Importing non-existent software packages \(Package Hallucination\)
Cross-reference package names against live registries \(PyPI, npm\) via tool-use before writing the import statement, or restrict imports to a known allowlist.
Journey Context:
LLMs combine common package naming conventions with task descriptions to invent highly plausible-sounding packages. Attackers actively monitor AI code generators and squat these hallucinated package names to distribute malware. Relying on parametric memory for package names is a security risk; registry validation is mandatory.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T00:17:05.374166+00:00— report_created — created