Jul 2026· ACM Transactions on Software Engineering and Methodology· 0 citations· 53 references
TL;DR
An autonomous defense agent is designed: NymGuard, which provides a proactive defense by automating the real-time detection of hallucinated packages, their preemptive registration to block malicious use and the maintenance of a public warning registry.
Abstract
In code generation tasks, large language models (LLMs) frequently recommend nonexistent software packages, referred to as package hallucinations. This may pose a security risk, as attackers could register these fake packages and exploit them in supply chain attacks. To investigate the real-world feasibility, this paper conducts a systematic empirical study of this potential threat. We extracted 107 hallucinated packages from eight prominent LLMs and uploaded them to the npm registry over six months. The results demonstrate a tangible risk: 35.2% of package installations are attributed to developers, with most initial interactions occurring within a two-week window post-registration. A name similarity analysis further reveals that 25.2% of hallucinated names fall within an absolute edit distance of \(\leq\) 1 from existing npm packages, posing a direct typosquatting risk. In our evaluated setting, tool-augmented generation, specifically using web search, fails to mitigate this threat. Instead, it significantly amplifies hallucination persistence from 11.2% to 17.3% through context contamination. In the npm registry, the entire attack campaign costs only an estimated $496, making it far more accessible than traditional supply chain attacks yet capable of enabling poisoning effects. To mitigate this emergent threat, we design an autonomous defense agent: NymGuard. It provides a proactive defense by automating the real-time detection of hallucinated packages, their preemptive registration to block malicious use and the maintenance of a public warning registry. The full implementation has been open-sourced and is available on GitHub (https://github.com/xiaoye798/Package-Hallucination-Research).
The results recast package hallucination as both a measurement problem and a decoding-time control problem, and they demonstrate that the choice of defense must be matched to the threat model and recommendation utility.
Albérick Euraste Djiré, I. E. Olatunji, Melissa Tessa et al.· Proceedings of the 41st IEEE...· 1 citation
A two layer detector to counter'slopsquatting of Python package names, with findings that hallucination rate scales almost linearly with prompt adversariality, and when primary and fallback share a model family, approximately 84% of primary failures recur on the fallback, motivating cross family pairing.
The first large-scale measurement of skill name hallucination is conducted, evaluating 15,000 prompts across 12 configurations and revealing a systemic vulnerability: every configuration hallucinates.
This work evaluates a three-mechanism mitigation stack consisting of database-grounded context injection, fixed vocabulary constraints, and enforced JavaScript Object Notation output across three commercial LLM providers, two model generations, and two output modes (standard and reasoning), totaling 6912 Application Pr...
Lavdim Menxhiqi, Galia Marinova· Applied Informatics· 0 citations
This tutorial presents a unified forensic perspective on LLM content misuse, combining hands-on copyright-risk auditing with a flexible plagiarism module, and equips attendees with practical and conceptual tools for auditing black-box models, interpreting similarity evidence, and understanding content misuse beyond sim...
Deng-Hui Zhang, Guangwei Zhang, Dongwon Lee· Proceedings of the 32nd ACM...· 0 citations
With the increasing usage of AI-generated code in software development workflows, new security challenges and concerns arise. This paper analyzes five LLMs: ChatGPT, Claude, Gemini, DeepSeek, and Grok in three phases of security assessments against web vulnerabilities listed by the OWASP Top 10. Phase 1 (December 2025)...
Malak Mansour, Anas AlMajali· IEEE Jordan Conference on Ap...· 0 citations
We use cookies to run the site and, with your consent, for analytics and to show ads.
See our Cookie Policy.