TL;DR: Large language models still recommend nonexistent packages at material rates, with 24.2% hallucinations in GPT-4, 22.2% in GPT-3.5, 64.5% in Gemini, and 29.1% in Cohere across 47,803 how-to prompts, according to Lasso Security research. The risk is not just bad answers, but a poisoned dependency path that security and engineering teams must validate before code reaches production.
At a glance
What this is: This research shows that AI package hallucinations remain a real supply-chain risk because models can recommend nonexistent dependencies that developers may try to install.
Why it matters: It matters because engineering and security teams now need to treat LLM-suggested packages as untrusted input, with validation controls before any dependency reaches a build or production path.
Context
AI package hallucination is the pattern where a model recommends a package, library, or module that does not exist, or points developers toward a dependency path that is unsafe or unusable. In practice, this turns a simple coding query into a supply-chain decision point, because the user may copy the suggestion straight into a build.
The governance gap is not just bad model output. It is the lack of a control layer between AI-generated dependency advice and software acquisition, where package provenance, namespace ownership, and repository existence should be checked before anything is trusted. For NHI and software supply chain teams, that makes the model part of the intake path, not the authority.
Lasso Security’s follow-up research expands the sample set and shows the problem persists across multiple models and languages, including evidence of repetition and cross-model overlap. That makes this a repeatable control issue, not an isolated prompt failure.
Key questions
Q: How should security teams handle AI-suggested packages before they reach production?
A: Treat AI-generated dependency names as untrusted input. Teams should verify that the package exists, confirm who maintains it, review recent activity, and route installation through approved registries or proxies. If a package cannot be validated quickly, it should not enter the build path. The control objective is to stop suggestion-to-installation shortcuts.
A: Because the attacker does not need to break the model to exploit the output. If developers or pipelines trust an invented package name, the error becomes an intake problem and can lead to malicious registration, copy-paste installation, or internal propagation. The control point is external verification, not faith in the model’s confidence.
Q: What signs show that AI package hallucinations are becoming a governance problem?
A: Watch for repeated false package names across teams, developers copy-pasting model output into installs, and dependency approvals based on search results instead of registry evidence. Those patterns show that AI output has crossed from productivity aid into an unmanaged acquisition channel that needs policy and technical controls.
Q: What should organisations do before allowing AI-generated dependencies into production?
A: They should require a controlled approval workflow that checks package existence, maintainer identity, signature or checksum, and vulnerability history. That workflow should sit between model output and installation so an invented package cannot move directly into production tooling or release pipelines.
Technical breakdown
How AI package hallucinations become a supply-chain entry path
An AI package hallucination becomes dangerous when a developer treats model output as a dependency recommendation rather than a tentative suggestion. The model may invent a package name, describe a plausible install path, or mirror a real naming pattern closely enough that it looks legitimate. That is enough to create a supply-chain intake problem, because the human still makes the final installation decision. The security failure is not the hallucination alone. It is the absence of a validation gate that checks package existence, ownership, repository history, and namespace legitimacy before adoption.
Practical implication: require provenance checks before any AI-recommended dependency is accepted into source control or build pipelines.
Why repeated hallucinations increase exploitation risk
Repeated hallucinations matter because they make the attack path more scalable. If a model tends to recommend the same nonexistent package across similar prompts, an attacker can seed malicious repositories or claim the invented name before developers or scanners spot the pattern. Cross-model overlap increases the chance that the same fake package name will surface in multiple workflows, which broadens exposure. This is especially relevant where developers use AI assistants for speed and where package names are accepted with minimal review. The control failure is not just one bad answer, but a pattern that can be predictably harvested.
Practical implication: track recurring hallucinated package names and block them at repository, proxy, and policy layers.
Why package ecosystem differences change the risk profile
The risk does not land the same way in every language ecosystem. In centralized registries, a hallucinated package can sometimes be created or squatted quickly, which makes namespace abuse easier. In ecosystems with distributed or constrained publishing rules, some hallucinations may be non-exploitable because the path cannot actually be claimed. That means teams need language-specific validation logic rather than a single generic policy. The right question is not whether the model was wrong, but whether the suggested dependency could be published, impersonated, or substituted in the target ecosystem.
Practical implication: tune dependency review rules to the publishing model of each language and registry you support.
Threat narrative
Attacker objective: The attacker wants developers to install or trust a dependency path they control, turning a fabricated package name into an entry point for malicious code or squatting.
- Entry occurs when a developer asks an LLM for implementation help and receives a package name that does not exist or should not be trusted.
- Credential access is replaced here by dependency trust, where the false package recommendation becomes the object the attacker wants the user to act on.
- Impact occurs when the invented package is copied into a build, enabling malicious code introduction, repository squatting, or downstream supply-chain compromise.
Breaches seen in the wild
- LiteLLM PyPI package breach: LiteLLM PyPI supply chain attack, credentials stolen from users.
Read and download The State of NHI & AI Agent Breach Report 2026, covering 200+ breaches impacting Non-Human Identities including AI Agents.
NHI Mgmt Group analysis
AI package hallucinations are a software supply-chain control failure, not just a model-quality issue. The real risk starts when developers treat a model answer as a dependency recommendation and skip normal provenance checks. That shifts the problem from prompt reliability into package intake governance, where repository existence, ownership, and maintenance history should already be verified. The implication is that AI-assisted development needs dependency validation as a control boundary, not a courtesy review.
Hallucinated package names create a new form of dependency trust debt. Once a fictitious package name is repeated across prompts or models, it becomes a reusable social and technical artifact that attackers can monitor, register, or imitate. That is especially important in open source ecosystems where names can be claimed quickly and where users often trust search results more than package lineage. Practitioners should treat invented dependency names as a standing threat intelligence feed, not a curiosity.
Cross-model repetition shows that the problem is structural, not model-specific. When multiple LLMs converge on the same fake package names, the security issue sits in the interaction between autocomplete-style assistance and human confirmation bias. The category is now large enough that teams cannot rely on users spotting obvious errors. The implication is that governance must move upstream into approved package lists, dependency proxying, and build-time allowlists.
Package ecosystems determine whether hallucination becomes exposure, but they do not eliminate the risk. Some languages make it harder to publish a fake dependency, while others make namespace abuse far easier. That means organisations need environment-specific control design rather than a single “ban AI suggestions” response. The practitioner takeaway is to align dependency governance to the publishing mechanics of each ecosystem, especially where AI tools are used for code discovery.
AI-assisted development is now part of the software supply chain attack surface. The important boundary is no longer just source control and CI, but the path from natural-language question to dependency selection. Once that path is ungoverned, attackers can exploit suggestion quality, naming plausibility, and user trust without compromising the model itself. Security teams should therefore treat AI-assisted dependency intake as a governed acquisition process.
From our research library:
- AI-related credential leaks surged 81.5% year-over-year in 2025, with the surrounding AI infrastructure leaking 5x faster than core LLM providers, according to the State of Secrets Sprawl 2026.
- Read next: AI Supply Chain Security and AI-BOM Guide
What this signals
Dependency trust debt: AI-generated package names should be treated as inventory candidates until they are proven real, maintained, and safe to consume. That changes the operating model for application teams, because package selection can no longer start and end with a model response.
The strongest control point is the acquisition boundary, not the editor or IDE. If an organisation cannot verify package identity, provenance, and publishing legitimacy before install, it has already accepted an upstream supply-chain risk that AI simply made easier to trigger.
For practitioners
- Validate every AI-suggested dependency Check package existence, maintainer identity, release history, and repository activity before allowing a suggested library into code or build pipelines.
- Block unapproved package names at the gateway Use dependency proxies, internal allowlists, and build policy to stop invented or squatted names before installation is attempted.
- Track recurring hallucinated package names Log repeated false suggestions from LLM workflows and feed them into threat intelligence, code review, and developer guidance.
- Separate AI assistance from package approval Let AI help draft options, but require a human or policy checkpoint to approve the final dependency choice for production use.
Key takeaways
- AI package hallucinations turn model output into a supply-chain intake problem when developers trust invented dependency names.
- The article shows that hallucinated packages can repeat across prompts and models, which makes the risk predictable enough to govern.
- The practical control is to verify package identity and provenance before installation, then block unapproved dependencies at the registry or proxy layer.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP API Security Top 10 addresses the attack and risk surface, while OWASP SAMM, SLSA and CIS Controls v8 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP SAMM | Software security requirements | The article is about shifting dependency risk into the SDLC and approval workflow. |
| Recommendation — Embed package verification into software assurance gates before dependencies are merged or deployed. | ||
| OWASP API Security Top 10 | API9 — Improper Inventory Management | Hallucinated packages expose poor inventory and trust over what libraries are actually in use. |
| Recommendation — Inventory approved dependencies and block imports that are not explicitly registered or validated. | ||
| SLSA | L3 — Build integrity | The article concerns trusted software acquisition before artifacts enter the build path. |
| Recommendation — Apply SLSA-aligned provenance checks so unverified dependencies cannot enter release pipelines. | ||
| CIS Controls v8 | CIS-16 — Application Software Security | The risk arises inside developer workflows and dependency selection for applications. |
| Recommendation — Use application security controls to require approved libraries and automated dependency review. | ||
Key terms
- AI Package Hallucination: An AI package hallucination occurs when a language model invents a software dependency that sounds plausible but has no legitimate existence or trustworthy provenance. In practice, this can mislead developers into searching for, installing, or documenting a false package, creating a supply-chain risk around unverified software intake.
- Dependency Update Trust Boundary: The dependency update trust boundary is the point where automated package or image updates cross from approved maintenance into code execution. When that boundary is weak, a trusted automation event can deliver attacker code into environments that hold secrets and release privileges.
- Package Squatting: The practice of publishing malicious packages whose names imitate legitimate brands, libraries, or namespaces. It succeeds when developers or automation choose based on familiar naming patterns and do not verify publisher identity or provenance before installation.
- Provenance Validation: A control approach that verifies where a payment, credential, or approval came from, who authorised it, and whether its path matches expected business logic. It is stronger than appearance-based review because it anchors trust in lineage and context, not visual similarity.
Deepen your knowledge
NHI governance, agentic AI identity, and machine identity lifecycle are core topics in our NHI Foundation Level course, the industry's only accredited NHI security programme. If you are building or maturing an IAM programme, it is worth exploring.
Published by the NHIMG editorial team on June 9, 2026.
Updated on October 10, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org