Skip to content
RCE Write-up Intermediate

$19,500 for a Package Name That Didn’t Exist Yet: A Dependency Confusion Supply Chain Takeover

An internal package name was referenced without a scope and was unclaimed on the public npm registry, allowing an attacker to publish a higher-versioned package with the same name. A build agent installed the attacker's package, confirming code execution in the build infrastructure.

T4nv1 Follow

Published on medium.com

This bug never touched Hartwell’s actual application code, their servers, or anything resembling a traditional request-response exploit chain. The entire attack happened on a public package registry, days before anyone at the company would run the install command that quietly pulled my code into their build pipeline…

T4nv1, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The internal package name had no scope and was not reserved on the public registry, so a higher-versioned public package could be substituted.

Impact

Arbitrary code execution within the build infrastructure was confirmed, with no access to any company system required.

What the attacker needed

Public repository with dependency manifest; internal package name unscoped and unclaimed; build resolves against public registry

The fix

The company reserved the affected name and enforced scoped package naming across its build systems.

How it was found

  1. Collect dependency manifests from public repositories and flag internal-looking package names.
  2. Manually verify that the candidate name is unclaimed on the public npm registry.
  3. Publish a package with the exact name and a much higher version, containing only an inert callback.
  4. Monitor the callback endpoint and confirm a request from an internal build agent.
  5. Unpublish the package within an hour of confirmation.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Companies often use private packages with ordinary names. If a build tool checks the public registry too and picks the highest version, an attacker can publish a package with the same name and a higher version. The build then installs the attacker's code instead of the company's own.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by T4nv1

View all

113 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.