A dependency attack targets the external components that software pulls in during build or runtime, such as open source libraries, modules, and transitive packages. Attackers exploit trust in these dependencies to introduce harmful code, manipulate versions, or redirect teams toward compromised artifacts.
What a dependency attack is targeting
A dependency attack exploits the trust relationship between a project and the components it imports from elsewhere. The target is not only the code you wrote, but also the packages, libraries, transitive dependencies, and build-time artifacts that your software accepts as upstream inputs.
This matters because modern software systems inherit behaviour from many outside sources. A compromised package can arrive through a direct dependency, but also through a dependency-of-a-dependency, a poisoned update channel, or a lookalike artifact that developers pull in during routine maintenance.
How dependency attacks work in practice
Attackers usually aim to get malicious code into a place that will be installed, built, or executed as if it were legitimate. Common techniques include typosquatting, dependency confusion, maintainer account compromise, malicious version updates, and substitution of a compromised package or artifact for the expected one.
The practical danger is that the attack often blends into normal development activity. Teams expect dependencies to change, updates to be frequent, and build systems to fetch packages automatically. That normality makes trust abuse especially effective, because the malicious component can look like maintenance rather than intrusion.
Open source ecosystems are especially exposed when package naming, publishing, and update trust are weak. Guidance from OpenSSF is useful here because it focuses on securing the software supply chain around the exact ecosystem where dependency attacks happen.
Why dependency attacks are security problems, not just supply chain nuisances
A dependency attack can do more than break a build. It can introduce remote code execution, credential theft, data exfiltration, unauthorized outbound traffic, or stealthy backdoor behaviour inside software that otherwise appears trustworthy.
In many cases the blast radius is larger than one application. If the same package is reused across multiple services or build pipelines, a single compromised dependency can spread quickly across environments. That makes dependency trust a systemic security issue, not a one-off software quality defect.
For broader attack context, the MITRE ATT&CK Enterprise Matrix is useful for mapping follow-on behaviours such as credential access, persistence, and lateral movement once malicious code has been introduced.
What makes dependency attacks hard to detect
These attacks often succeed because they arrive through normal channels and inherit legitimate trust. A package may be signed, versioned, mirrored, cached, or pulled from an approved registry and still be malicious if the upstream maintainer, publishing path, or artifact source has been compromised.
Detection is harder when organisations do not maintain a clear inventory of what they actually use, where each dependency came from, and which builds rely on it. Once a dependency is nested deeply enough, teams may not even realise they are consuming it directly, which makes exposure and response much slower.
Supply chain monitoring and source verification guidance from CISA cyber threat advisories can help teams keep pace with active campaign patterns and compromise methods. For software build integrity specifically, the OpenSSF ecosystem remains a useful reference point for package and artifact trust controls.
What dependency attacks mean for governance and remediation
Dependency attacks force teams to treat third-party code as part of their attack surface. That means ownership for dependency approval, update policy, provenance checks, and incident response has to be explicit, not assumed.
When a malicious dependency is discovered, the response is usually broader than removing one package. Teams often need to revoke or rotate credentials exposed during build or runtime, identify every application that consumed the artifact, and review whether transitive reuse spread the exposure further.
For organisations that want a deeper case-based view of real-world compromise patterns, The 52 NHI Breaches Report includes breach patterns that help illustrate how trusted software paths can become attack paths. LiteLLM PyPI package breach is a concrete example of how a compromised package can turn dependency trust into credential exposure.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
MITRE ATT&CK addresses the attack and risk surface, while CIS Controls v8, OWASP ASVS, SLSA and NIST SP 800-53 Rev 5 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| MITRE ATT&CK | T1195 — Supply Chain Compromise | Dependency attacks are a supply-chain compromise pattern that abuses trusted software inputs. |
| Recommendation — Map package compromise paths to T1195 and monitor for malicious updates or substituted artifacts. | ||
| CIS Controls v8 | CIS-16 — Application Software Security | Dependency attacks are mitigated through secure software acquisition and integrity controls. |
| Recommendation — Enforce software integrity checks and approved-source controls for third-party dependencies. | ||
| OWASP ASVS | V15 — Secure Coding and Architecture | Dependency trust and third-party code handling are part of secure application architecture. |
| Recommendation — Validate third-party component trust assumptions and restrict unsafe dependency inclusion. | ||
| SLSA | Supply Chain Levels for Software Artifacts | Dependency attacks target build provenance and artifact integrity across the software supply chain. |
| Recommendation — Adopt provenance and integrity requirements that make dependency substitution harder. | ||
| NIST SP 800-53 Rev 5 | SA-10 — Developer Configuration Management | Third-party components and version control in the build chain are directly governed here. |
| Recommendation — Track and approve external components before they enter production builds. | ||
Related resources from NHI Mgmt Group
- Attack Surface Management
- Who should own containment when a dependency attack exposes cloud and repository credentials?
- What breaks when organisations cannot see their transitive dependency attack surface?
- What are the signs that a package-based supply chain attack is operating beyond a simple typo-squat or nuisance dependency?
Deepen Your Knowledge
Reviewed and updated by the NHIMG editorial team on September 26, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org