Dependency Chain Abuse

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

Dependency Chain Abuse — Training Steps

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. Why the wrong one won

  6. 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.

  7. See what resolved

    Alice opens the public listing the monitor pointed at, to confirm what the build actually pulled.

  8. 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.

  9. 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.

  10. 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