Join our Newsletter — 33% off our NHI Course
Home› Glossary› Cyber Security› Sub-Dependency Execution
Cyber Security

Sub-Dependency Execution

← Back to Glossary
By NHI Mgmt Group Updated October 12, 2026 Domain: Cyber Security

A malicious action triggered by code that sits below the top-level package a developer thinks they are installing. It matters because review and approval often focus on visible dependencies, while nested packages can still run during install or build time.

What Sub-Dependency Execution Means in Practice

Sub-dependency execution is a software supply-chain risk where code hidden several layers deep in a dependency tree can run during install, build, or test phases. The danger is not only that the package is unwanted, but that its execution may happen before a reviewer ever inspects it closely.

This pattern matters because modern package managers often resolve and activate nested dependencies automatically. A developer may believe they are approving one top-level library, while the actual execution path includes additional packages with their own scripts, transitive requirements, and update behaviour.

How Hidden Dependency Layers Create Exposure

Deep dependency trees expand the attack surface because trust is often applied unevenly. Reviewers may validate the visible package name, publisher, or README, but nested components can still carry install-time code, post-install hooks, or build-time logic that executes as part of normal workflow.

That makes the subject less about a single bad package and more about control loss across the dependency graph. When a lower-layer component is compromised, the attack inherits the trust of the higher-layer package and can ride into developer machines, CI runners, or build infrastructure.

OpenSSF is a useful reference point for understanding why open source supply chain controls must extend beyond the package a team thinks it installed.

Why Review Processes Miss It

Sub-dependency execution slips through because many review processes are package-centric rather than dependency-graph-centric. Security teams may approve a visible dependency list, but that does not guarantee the full transitive closure is safe, pinned, or even fully observed.

Another weakness is that install-time execution can look routine. A nested package may run code as part of setup, build tooling, or environment preparation, which means the malicious action blends into expected developer activity rather than standing out as an obvious runtime exploit.

SLSA is relevant here because provenance and build integrity are central to reducing the chance that hidden package behaviour reaches production artefacts.

Defensive Meaning for Supply-Chain Security

Defending against sub-dependency execution requires treating dependency resolution itself as a security boundary. Teams need visibility into transitive packages, the ability to inspect install and build behaviour, and controls that reduce surprise execution from nested components.

The practical lesson is that package approval is not enough if downstream code can still run automatically. Security decisions need to account for dependency depth, package scripts, lockfile integrity, and the difference between what was intended and what actually executes.

NIST SP 800-53 Rev 5 Security and Privacy Controls provides a useful control lens for configuration management, integrity, and software execution governance.

Risk and Threat Considerations

Sub-dependency execution creates a supply-chain compromise path because attackers do not need to control the most visible package in order to gain execution. A nested dependency, once trusted by the resolver or build system, can inject malicious behaviour into installation workflows, CI pipelines, or developer environments.

Failure mechanism: Hidden or transitive packages execute code during install or build time, and that code can download payloads, steal secrets, tamper with artefacts, or alter downstream dependencies before detection.

Impact: The result can be credential exposure, poisoned builds, compromised developer systems, and propagation of untrusted code into released software.

Standards & Framework Alignment

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

SLSA, NIST SP 800-53 Rev 5 and OWASP SAMM set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
SLSASupply-chain Levels for Software ArtifactsDirectly addresses build provenance and artifact integrity in software supply chains
Recommendation — Adopt SLSA to verify build provenance and reduce trust in unreviewed transitive code.
NIST SP 800-53 Rev 5CM-5 — Access Restrictions for ChangeControls unauthorized software changes and execution in managed environments
SI-7 — Software, Firmware, and Information IntegrityProtects against tampered or malicious code entering software execution flow
CM-10 — Software Usage RestrictionsLimits which software and package behaviours may run in the environment
Recommendation — Apply CM-5 to restrict unapproved software execution paths and dependency changes. Use SI-7 to verify software integrity and detect malicious dependency behaviour. Enforce CM-10 to block unnecessary package execution during install or build.
OWASP SAMMSoftware Assurance Maturity ModelSupports mature software supply-chain practices and secure build governance
Recommendation — Use OWASP SAMM to mature dependency review and secure build governance.

Practitioner Guidance

Why practitioners should care: The security decision is not only whether the top-level dependency is trusted, but whether every transitive component is visible, pinned, and constrained. Teams that only review the package they intentionally installed can miss the path where malicious behaviour is actually triggered.

Practitioner takeaway: Treat dependency trees, install scripts, and build-time execution as first-class review targets, not as implementation details.

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 October 12, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org