Dependency Chain Abuse
The name was exactly right. The registry it came from was not.
What Is Dependency Chain Abuse?
When a build can reach both a public registry and an internal one, an attacker who learns an internal package name publishes it publicly at a higher version, and resolution order does the rest. You'll watch a build pull an attacker's public package over the real internal one and run its install script with the pipeline's credentials, then fix it by resolving every package from one internal source and never running install scripts.
What You'll Learn in Dependency Chain Abuse
- When a build can resolve one name from both a public and an internal registry, a higher public version wins, with no spelling mistake involved.
- An install script runs automatically on install, so a package only has to resolve to execute code in the build with its credentials.
- Resolve every package from one internal source that mirrors only vetted public packages, so a name can never resolve from two places.
- Block lifecycle scripts on install and reserve a scope for internal packages, so the bare names cannot be claimed publicly at all.
Dependency Chain Abuse — Training Steps
-
An internal name in the open
Nemvar's builds install internal packages by their bare names, and the package manager is allowed to reach both Nemvar's internal registry and the public one. Bob found the name of an internal package, nemvar-telemetry, printed in one of Nemvar's public build logs. He did not break into anything. He published a package with that exact name to the public registry, at version 99.0.0.
-
Higher version, stranger author
The public registry will serve this package to anyone whose build asks for nemvar-telemetry. Two things about the listing are the whole attack: the version is absurdly high, and the publisher is an account nobody at Nemvar has ever heard of.
-
The script that runs itself
The package carries an install script. Any build that installs the package runs it automatically, with whatever credentials that build holds.
-
The build takes the bait
Bob runs an install against Nemvar's build config to confirm it works. The manager checks both registries, sees the public 99.0.0 next to the internal 2.4.1, and takes the higher one. Then it runs the install script.
-
Why the wrong one won
-
An install that phoned out
Nemvar's supply-chain monitor watches what the build installs and where from. Overnight it flagged a package pulled from the public registry that should only ever come from inside.
-
See what resolved
Alice opens the public listing the monitor pointed at, to confirm what the build actually pulled.
-
The same name, published by a stranger
There it is: Nemvar's internal package name, published to the public registry at 99.0.0 by an account created three days ago, carrying an install script. Anyone could claim this name publicly, because Nemvar never reserved it and the build trusts whatever the public registry returns.
-
How the build resolves
The cause is in the build's package settings. Alice opens the npm config to see where packages are allowed to come from, and what runs when they install.
-
Two registries, scripts on
Two settings are the whole hole: the default registry is the public one, so a bare internal name can be served from outside, and install scripts run on their own.
Security Framework Coverage
OWASP CI/CD Top 10
- CICD-SEC-3 Dependency Chain Abuse
CWE
- CWE-427 Uncontrolled Search Path Element
- CWE-829 Inclusion of Functionality from Untrusted Control Sphere
MITRE ATT&CK
- T1195.001 Supply Chain Compromise: Compromise Software Dependencies and Development Tools
CIS Controls
- CIS 2 Inventory and Control of Software Assets
- CIS 16 Application Software Security
NIST CSF
- PR.AT-02 Individuals in specialized roles are provided with awareness and training so that they possess the knowledge and skills to perform relevant tasks with cybersecurity risks in mind
- ID.AM Asset Management
- PR.PS Platform Security
NICE Framework
- DD-WRL-004 Secure Systems Development
- IO-WRL-005 Systems Administration
- OG-WRL-017 Cybersecurity Supply Chain Risk Management