Independent analysis by NHI Mgmt GroupSource article: Dam Secure, “How to choose dependency security software for AI-written code” (November 25, 2026)

TL;DR: AI coding agents speed package adoption in ways that expose teams to hallucinated dependencies, malicious package versions and namespace attacks that CVE-only scanning will miss, according to Dam Secure. Dependency governance now has to validate package reality, not just known vulnerabilities, because agents can introduce risk faster than traditional review loops can catch it.


At a glance

What this is: NHI Mgmt Group's analysis, drawing on Dam Secure's blog post: AI-written code and coding agents widen dependency risk by introducing hallucinated packages, malicious versions and faster supply chain attack paths.

Why it matters: IAM and AppSec teams now need governance that treats package selection, provenance and install-time trust as part of the control plane for AI-assisted development.

By the numbers:

  • In a USENIX Security 2025 study, 19.7% of the packages recommended by 16 code-generating models were hallucinated, with 205,474 unique fake names.
  • Researchers found that 43% of hallucinated package names came back in all 10 runs.
  • Phoenix Security counted 37 npm supply chain campaigns hitting 497 packages in the first half of 2026.
  • One June campaign compromised at least 32 packages under a single trusted namespace.

Context

Dependency security for AI-assisted development now has two separate failure modes. One is ordinary vulnerability exposure through known CVEs, and the other is package trust failure, where an AI system suggests or installs something that should never have been in the build in the first place. Malicious package and dependency confusion controls are relevant here because the risk is no longer limited to vulnerable versions.

Coding agents compress the time between code creation and dependency adoption. That creates a governance problem for software supply chains, because a human reviewer can no longer assume that package choice, package provenance and install-time behaviour were all examined with equal care.

The starting position described here is increasingly typical for AI-assisted software teams, not an edge case. Once agents can propose dependencies and act on upgrade work, dependency security becomes a runtime governance issue rather than a periodic scan result.


Key questions

Q: How do you stop hallucinated packages from entering software builds?

A: Treat package reality as a gate, not an assumption. Verify that every proposed dependency exists, has a credible release history and matches an approved ecosystem before install or merge. For AI-assisted workflows, block package additions that cannot be traced to a real, intended dependency and require lockfile-based installs so the build consumes only reviewed package versions.

Q: Why do malicious packages create more risk than CVE-based scanning usually captures?

A: Malicious packages often have no known CVE because the danger comes from intent, tampering, or suspicious activity rather than a published vulnerability. That means teams need controls that evaluate package reputation, maintainer behaviour, dependency graph context, and runtime exposure. Without those signals, security programmes can miss threats that look clean in traditional vulnerability lists.

Q: What is the difference between dependency confusion and slopsquatting?

A: Dependency confusion is an attack on package resolution, where an internal package name is registered in a public repository so build tools pull the attacker’s package instead of the private one. Slopsquatting is a software supply chain attack where an AI model hallucinates a package name and an attacker publishes that name, so developers install malware from the model output itself. Both are mitigated by scoped package registries, allowlists, and dependency pinning.

Q: How should teams prioritise dependency findings across many repositories?

A: Teams should prioritise dependency findings by exploitability, exposure, and blast radius, not by raw count. Fix internet-facing services, shared libraries, authentication paths, and transitive dependencies that appear in many repositories first, then address low-reach components. Use central package inventory, reachability analysis, and a patch queue keyed to the version that fixes them.


Technical breakdown

How hallucinated package names become an attack surface

Code-generating models can invent package names that look plausible enough for a developer or agent to trust. Once those names repeat across prompts, attackers can register them and wait for installation attempts, which turns model output into a predictable dependency intake channel. The key security issue is not only that the package is fake, but that the model repeatedly normalises the same fake dependency across runs. That makes the attack scalable and gives defenders a measurable set of names to block.

Practical implication: Block unverified dependency suggestions before they reach package managers or agentic install steps.

Why CVE matching misses malicious package versions

CVE-based tooling is designed to find known vulnerabilities in legitimate software, not packages that are malicious by design. A malicious release may have no advisory history because it was created to deliver payloads, harvest secrets or subvert build trust. That means a dependency programme needs both vulnerability intelligence and package legitimacy checks. Without that distinction, security teams can report clean scans while still allowing hostile packages into repositories and build pipelines. Read Top 10 Open Source Software Risks.

Practical implication: Pair advisory matching with controls that assess whether a package release is legitimate before install.

Why agentic dependency remediation changes the control model

When a coding agent can take a finding and upgrade the affected package directly, the dependency workflow shifts from advisory display to machine-executable remediation. That is useful only if the finding is grouped by the version that actually fixes the issue and if the agent is constrained to approved repositories and versions. Otherwise, the same automation that speeds remediation can also accelerate unsafe upgrades or pull in the wrong package lineage. See the AI Coding Agents Security Guide.

Practical implication: Scope agentic remediation to approved versions, approved repos and packages with verified provenance.


Threat narrative

Attacker objective: The attacker wants a predictable path from model output to package installation so malicious code or compromised dependencies enter real software pipelines.

  1. Entry occurs when a code model or coding agent suggests a package name that looks valid but does not actually belong to the intended software ecosystem.
  2. Credential or package trust abuse follows when an attacker has already registered that name or published a malicious version under a trusted namespace.
  3. Impact occurs when the agent or developer installs the package, bringing malicious code, namespace compromise or hidden dependency risk into the build path.

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

Dependency trust is becoming a governance problem, not just a scanning problem. AI-written code changes how dependencies enter the build, because package choice can now be machine-generated, machine-approved and machine-installed. That breaks the assumption that a human always catches bad package names before they reach the pipeline. Practitioners should treat package legitimacy as a control objective in its own right, not as a by-product of vulnerability management.

Slopsquatting turns model predictability into a supply chain weakness. When hallucinated package names repeat across runs, attackers can weaponise those names by registering them before the development team notices. That is a distinct failure mode from ordinary dependency confusion because the source of the bad name is the model itself, not just a typo or namespace collision. Security teams need controls that detect whether the dependency was ever real before they let advisory logic decide whether it is safe.

Malicious package detection must sit alongside CVE intelligence. CVEs explain known defects in known software, but 2026 npm campaigns show that hostile releases can be weaponised before any advisory exists. This creates a standing gap between package vulnerability management and package legitimacy management. Teams that only measure exposure through advisory counts will miss the more important question of whether a package should have been admitted at all.

Agentic remediation raises the value of fix grouping and provenance. If a coding agent is going to apply upgrades directly, the organisation needs a smaller number of higher-confidence remediation choices, each tied to the version that actually resolves the issue. That shifts the market toward better package grouping, better provenance signals and tighter install policies. The right governance model is one where automation can move fast only inside a trusted dependency boundary.

AI-assisted development now extends OWASP-NHI-style thinking into software supply chains. The relevant risk is no longer only secrets in code or over-privileged workloads; it is also whether an agent can introduce an untrusted external dependency into production through its normal operating flow. That makes package provenance, install-time policy and release-age controls part of the identity-adjacent trust model for development pipelines. Practitioners should govern dependency intake as a machine-mediated trust decision.

From our research library:

What this signals

Package reality is becoming a control point in AI-assisted development. When agents can generate code and package suggestions together, the organisation needs to decide whether a dependency even exists before it debates whether that dependency is vulnerable. That is a different governance step from conventional SCA, and it shifts review effort left into admission controls rather than post-install triage. Use package legitimacy checks to keep agent output inside a governed supply chain.

Provenance is now part of dependency trust, not a niche supply chain concern. The move toward agentic remediation means package upgrades will increasingly be executed by systems that did not create the original codepath. That makes release-age policy, lockfile discipline and provenance validation central to operational resilience. A package with a clean advisory record can still be unsafe if its admission path is uncontrolled.

AI coding agents leaked secrets at a rate of 3.2%, more than double the human-only baseline of 1.5%, according to the State of Secrets Sprawl 2026.


For practitioners

  • Validate every new dependency name before install Check that the package exists, has a plausible history and matches the dependency you intended before allowing a PR or agent to introduce it.
  • Separate malicious package detection from CVE scanning Use controls that can flag hostile releases even when no vulnerability advisory exists, especially for fresh versions and suspicious namespaces.
  • Block install scripts by default Prevent packages from executing install-time payloads unless they are explicitly allowlisted, and keep the allowlist narrow.
  • Freeze dependency sets for agentic workflows Require committed lockfiles and fixed package sets when coding agents create or update software so the agent cannot pull a different dependency graph on each run.
  • Group remediation by fixing version Prioritise upgrades that clear the most advisories at once so developers and agents resolve multiple findings through a single controlled change.

Key takeaways

  • AI-written code changes dependency risk by creating a faster path for fake, malicious or unreviewed packages to enter builds.
  • CVE matching alone is insufficient because hostile packages can be introduced without any advisory history, especially in AI-assisted workflows.
  • Effective governance now depends on package legitimacy checks, lockfile discipline and remediation flows that are safe for agents to execute.

Related NHI Mgmt Group resources: AI Coding Agents Security Guide · AI Supply Chain Security and AI-BOM Guide · Malicious Package and Dependency Confusion Guide · Dependency Update Automation Guide


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, OWASP Non-Human Identity Top 10 and MITRE ATT&CK define the specific risk controls and attack patterns relevant to this term.

FrameworkControl / ReferenceRelevance
OWASP API Security Top 10API10 — Unsafe Consumption of APIsPackage intake through automated tools mirrors unsafe consumption of untrusted external interfaces.
Recommendation — Treat untrusted package intake like unsafe API consumption and require validation before acceptance.
OWASP Non-Human Identity Top 10NHI-02 — Secret LeakageAI coding agents increase the chance that secrets and unsafe artifacts flow through automation.
NHI-03 — Vulnerable Third-Party NHIThird-party packages and agents create upstream trust dependencies that can be compromised.
NHI-09 — NHI ReuseRepeated hallucinated package names and repeated dependency patterns create predictable reuse across runs.
Recommendation — Contain agent-generated outputs so they cannot introduce exposed credentials or unsafe dependency artefacts. Vet third-party dependency sources and revoke trust when a package lineage becomes suspicious. Detect repeated dependency patterns that make agent output predictable and exploitable.
MITRE ATT&CKTA0006; TA0010 — Credential Access; ExfiltrationThe article links malicious packages to compromise paths that can reach secrets and downstream impact.
Recommendation — Map malicious package activity to credential access and exfiltration indicators in your detection pipeline.

Key terms

  • Slopsquatting: Slopsquatting is a supply-chain attack that exploits hallucinated package names suggested by AI systems. An attacker registers the invented name in a public registry and waits for a developer or build pipeline to install it. The risk sits at the intersection of model error, dependency trust, and software delivery speed.
  • Hallucinated Package Name: A hallucinated package name is a dependency string produced by an AI model that looks valid but does not exist in the intended registry. In security terms, it becomes dangerous when a real attacker claims the name and uses it as a delivery path.
  • Malicious Package: A malicious package is software published into a legitimate repository but designed to execute harmful code when installed. It abuses normal dependency workflows so that the attacker’s code reaches the environment through trust in the package ecosystem, not through a traditional exploit.
  • Dependency Confusion: A supply chain attack in which a build system resolves a malicious public package instead of an intended internal one because of naming, versioning, or registry precedence. The risk is not only code substitution but automatic execution inside trusted pipelines that already contain valuable credentials.

Deepen your knowledge

The NHI Foundation Level course, the industry's only accredited NHI security programme, covers NHI governance, workload identity and secrets management through a practitioner lens. It gives security and platform teams a common language for governing machine-mediated trust decisions across modern development pipelines.
NHIMG Editorial Note
Published by the NHIMG editorial team on November 25, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org