Join our Newsletter — 33% off our NHI Course
Home› Glossary› Threats, Abuse & Incident Response› Package Namespace Shadowing
Threats, Abuse & Incident Response

Package Namespace Shadowing

← Back to Glossary
By NHI Mgmt Group Updated November 4, 2026 Domain: Threats, Abuse & Incident Response

A supply-chain tactic in which a public package is named to resemble an internal or private dependency so that automated resolution pulls in the wrong artifact. This exploits trust in package naming, registry configuration, and developer expectations during install time.

What Package Namespace Shadowing Is

Package namespace shadowing is a supply-chain attack pattern, not just a naming quirk. The attacker publishes a public package whose name is close enough to an internal dependency that automated resolution, registry lookup, or developer assumptions pull in the wrong artifact during install. The abuse sits at the boundary between package naming, resolution order, and trust in repositories.

Because many build systems prefer a highest-priority source or a seemingly exact name match, the technique can succeed without exploiting code execution or a software bug in the usual sense. The real weakness is the assumption that package names alone reliably identify provenance, ownership, or intended scope.

How Namespace Shadowing Works in Package Ecosystems

Shadowing usually depends on one of three conditions: a public registry is searched before the private source, a namespace is not reserved or bound tightly enough, or a developer tool interprets the name as authoritative without verifying origin. The malicious package may be a direct copy of the expected API surface, or it may only need to look plausible enough to be installed automatically.

In practice, the attack is strongest where install-time automation is broad and human review is thin. CI jobs, dependency updaters, and ephemeral build agents can ingest the wrong package before anyone notices, especially when package managers support fallback to public registries or multiple indexes.

Open-source ecosystem guidance from OpenSSF is useful here because it frames package ecosystem security as a provenance and trust problem, not only a code-quality problem.

Why It Is Dangerous

The danger is that the package may execute during install, build, or test phases, which turns a naming trick into code execution inside the software supply chain. That can expose source code, tokens, build secrets, signing material, or internal configuration, and it can also poison downstream releases if the wrong dependency becomes part of a shipped artifact.

The impact is amplified when the targeted package is deeply embedded, because one shadowed dependency can affect many services or many builds at once. Even when the malicious artifact is detected quickly, the organisation still has to assume that affected build environments, developer workstations, caches, and generated artifacts may have been exposed.

The strongest preventive pattern is to bind private namespaces and resolution order explicitly, as described in Private Package Repository and Proxy Guide, which explains how curated indexes and namespace binding reduce dependency confusion and shadowing risk.

How Organisations Check Exposure and Reduce the Blast Radius

Exposure checks start with inventory: which private package names exist, which repositories are allowed, and which build paths can reach public registries. Teams should also review package manager configuration, proxy behavior, and any fallback logic that could let a public package win a resolution race.

Where the organisation uses repository managers or mirrored registries, the key question is whether the intended namespace is actually reserved and enforced. If the same name can exist publicly, then the private package should be pinned by source, scope, or repository policy rather than by convention alone.

Where package metadata, install scripts, or release provenance matter, the operational concern is not just whether the artifact exists, but whether the build pipeline can distinguish the expected package from a lookalike before any code is run. That is why Malicious Package and Dependency Confusion Guide is directly relevant to namespace shadowing, because the same controls that stop dependency confusion also reduce namespace impersonation.

Standards & Framework Alignment

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

CIS Controls v8, NIST SP 800-53 Rev 5, SLSA, OWASP ASVS and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
CIS Controls v8CIS-15 — Service Provider ManagementPackage registries and proxies are third-party supply-chain dependencies that need governance and trust boundaries.
Recommendation — Review and govern package-source providers to ensure only approved repositories can supply build dependencies.
NIST SP 800-53 Rev 5SA-12 — Supply Chain ProtectionShadowed packages are a software supply-chain threat that requires source assurance and provenance controls.
Recommendation — Require provenance checks and approved sources before accepting external packages into the build chain.
SLSASupply-chain Levels for Software ArtifactsNamespace shadowing can introduce untrusted artifacts into builds, which SLSA addresses through provenance and integrity.
Recommendation — Adopt provenance verification so builds only consume dependencies from trusted, traceable sources.
OWASP ASVSV15 — Secure Coding and ArchitecturePackage resolution and dependency trust are software-architecture concerns that affect secure composition of applications.
Recommendation — Design dependency handling so package origin and integrity are verified before code is integrated.
NIST CSF 2.0PR.DS-10 — IntegrityNamespace shadowing threatens artifact integrity by substituting a lookalike package for the intended dependency.
Recommendation — Validate artifact integrity so the resolved package matches the intended dependency.

Practitioner Guidance

Why practitioners should care: Treat package names as identifiers of convenience, not proof of trust. The operational decision is whether your build and install path can still be tricked after an attacker chooses a plausible public name.

What to watch for: Look for repository fallback, uncoupled namespace ownership, inconsistent install sources, and packages that appear in logs or SBOMs from an unexpected registry. Those are the signals that resolution policy is weaker than the organisation assumes.

Practitioner takeaway: The safest posture is to make package origin explicit in policy and tooling, so a name match alone never decides what gets installed.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

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