Join our Newsletter — 33% off our NHI Course
Home FAQ Cyber Security Why do malicious packages and dependency confusion still…
Cyber Security

Why do malicious packages and dependency confusion still work in mature engineering environments?

← Back to all FAQ
By NHI Mgmt Group Editorial Team Updated August 26, 2026 Domain: Cyber Security

These attacks succeed because trust is often granted too early. Package names can be mistyped, internal names can be matched by public packages, and newly published malicious code may execute during install before scanners react. Human workflow errors, registry defaults, and rapid release cycles create openings that traditional post-install scanning cannot reliably close.

Why This Matters for Security Teams

Malicious packages and dependency confusion are not primarily tooling failures. They are trust failures in the software supply chain, where build systems often assume that package names, registries, and transitive dependencies are safe until proven otherwise. That assumption is fragile when developers pull from public and private sources, automate installs, or inherit dependencies they do not directly inspect. NIST guidance in the NIST SP 800-53 Rev 5 Security and Privacy Controls reinforces the need for controlled software acquisition, configuration management, and supply chain risk handling rather than relying on scanner-only defense.

The operational risk is broader than a single compromised library. A poisoned dependency can exfiltrate secrets, alter build artefacts, create persistence inside CI/CD, or introduce subtle logic changes that escape functional tests. Mature environments are especially exposed because they move quickly, reuse dependencies heavily, and often allow broad package installation privileges for developer productivity. Security teams sometimes focus on vulnerability severity while missing provenance, namespace control, and install-time execution.

In practice, many security teams encounter dependency abuse only after a build pipeline has already trusted the wrong package name or the wrong source.

How It Works in Practice

Dependency confusion works when an internal package name is also available in a public registry, and the build process resolves the public package first or without strict source pinning. Malicious packages work when an attacker publishes code that looks legitimate enough to be selected, installed, or imported by automated tooling. The problem is usually not that defenders lack scanners; it is that scanners often run after the risky event has already happened.

Effective controls need to operate before and during resolution, not just after installation. That means constraining where dependencies can come from, validating package provenance, and reducing the number of places where a build can silently substitute one package for another. MITRE’s supply chain and attack modeling resources, including MITRE ATT&CK, are useful for mapping how initial access can emerge from compromised software distribution paths.

  • Lock dependency sources to approved registries and block implicit public fallback for internal package names.
  • Use namespace protections, package reservations, or repository rules that prevent external reuse of internal names.
  • Pin versions and verify checksums or signed provenance where supported.
  • Restrict install-time script execution and review postinstall hooks, especially in CI/CD.
  • Separate build-time credentials from runtime secrets so a malicious installer cannot harvest reusable access.

Where organisation-wide policy exists, it should be enforced by the platform, not by individual developer habit. Controls are stronger when registry configuration, CI runners, and artifact promotion pipelines all apply the same trust rules. This is also where identity governance matters: service accounts, publishing tokens, and package maintainers are all non-human identities that need scoped permissions and review. These controls tend to break down when teams mirror multiple registries without deterministic resolution rules because package selection becomes environment-dependent.

Common Variations and Edge Cases

Tighter package controls often increase friction for developers, requiring organisations to balance delivery speed against provenance assurance. That tradeoff becomes more visible in polyglot environments, monorepos, and fast-moving CI pipelines where teams rely on transitive dependencies they do not own. Best practice is evolving, but there is no universal standard for every ecosystem’s signature, attestation, or namespace protection model yet.

Some ecosystems support stronger provenance signals than others, and some internal workflows still depend on legacy package mirrors or ad hoc overrides. In those cases, security teams should prioritise the highest-risk paths first: packages that can run install scripts, packages with privileged build access, and dependencies used in release pipelines or infrastructure automation. Current guidance suggests treating dependency resolution as a security control point, not a convenience feature.

Identity and agentic AI intersections are increasingly relevant. Build bots, release automation, and AI coding agents may install packages, approve upgrades, or generate dependency changes without the same skepticism a human reviewer would apply. That makes governance over tool permissions, secret exposure, and approval workflow critical. Strong controls are not just about blocking bad code; they are about making sure the entity allowed to fetch or publish code is actually the one intended.

For a broader control baseline, security teams can align with the OWASP guidance on software supply chain risk and treat dependency trust as part of engineering governance rather than a late-stage scan result.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Agentic AI Top 10 and MITRE ATLAS address the attack and risk surface, while NIST CSF 2.0, NIST AI RMF and NIST SP 800-53 Rev 5 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
NIST CSF 2.0PR.DSSupply chain integrity protects software and data from malicious dependencies.
NIST AI RMFAI systems can auto-generate or approve dependency changes without adequate oversight.
OWASP Agentic AI Top 10Agentic tools may fetch or modify dependencies using tool access and broad permissions.
MITRE ATLASAttackers can poison the software supply chain to influence downstream systems.
NIST SP 800-53 Rev 5SA-12Secure acquisition and supply chain controls apply directly to dependency trust decisions.

Restrict agent permissions, log actions, and require approval for package installation or publishing.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on August 26, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org