AI Security
Latest LLM models still hallucinate nonexistent code packages at rates matching 2024 systems
A new study finds that 2026 frontier AI models generate fake package names at 3.6–5.0% rates, creating security vulnerabilities despite overall improvements in model capability.
Large language models continue to produce references to software packages that don't exist—a vulnerability that could enable attackers to register fake package names and deliver malware to unsuspecting developers.
The Persistent Problem#
Researchers replicated a prior security study on five state-of-the-art models released in 2026, testing their outputs across nearly 200,000 Python and JavaScript code generation tasks. The hallucination rate—where models invent plausible-sounding but nonexistent package names—remained between 3.6% and 5.0% of all package mentions, or 2.2% to 3.4% across entire generations. Notably, this matches the performance of commercial models from 2024, indicating that improvements in raw model capability have not eliminated this specific class of error.
The researchers identified 104 package names consistently hallucinated by all five frontier models. Upon closer inspection, 26 of these earlier flagged names were actually valid Python import statements where the module name differed from its published package name—a distinction worth clarifying for future security work.
Attack Surface and Real-World Risk#
The hallucination threat feeds into slopsquatting, a technique where attackers monitor which fake packages LLMs suggest and quickly register those domain names on public registries like PyPI or npm. If developers blindly copy-paste suggested code, they may inadvertently install malicious software.
Testing against live package registries revealed an important finding: roughly 1% of hallucinated names were registered by someone within six months of the study period. This rate held steady regardless of whether package lists had been publicly disclosed six months earlier, suggesting publication alone does not accelerate attacks.
However, the underlying threat is real. At least 23 package names that the frontier models suggested had previously hosted malware that was later removed by registry operators. Even more concerning, one hallucinated name was registered with malware after the researchers completed their testing runs.
The Open-Source Gap Closes#
Python models hallucinated packages more frequently than JavaScript variants across all five frontier systems. A notable shift from 2024 is that the performance gap between open-weight and proprietary models has effectively closed, with all 2026 frontier systems sitting at similar hallucination rates.
The work represents a preregistered live revalidation against real package repositories, replacing static snapshots with continuous checks to capture the true current state of what exists in live registries.
