Skip to content
RCE Write-up Intermediate

Turning Dependency Confusion Research into a Profitable Stack

The author describes a dependency confusion vulnerability where internal package names were exposed in public code and JavaScript files, allowing an attacker to register malicious packages on public registries. When installed, these packages executed code on internal build servers, leading to remote code execution.

medium.com

Published on medium.com

This philosophy was the blueprint for my deep dive into Dependency Confusion vulnerabilities.

Abdelrhman Allam (sl4x0), 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

Likely the package manager prioritises the highest version number across public and private registries, and internal package names were exposed in public code.

Impact

An attacker could achieve remote code execution on internal build servers, potentially leading to credential theft and source code exfiltration.

What the attacker needed

Internal package name exposed publicly; ability to publish packages to public registry; victim installs dependencies

How it was found

  1. Scan public code repositories and JavaScript files for internal package names.
  2. Register a benign placeholder package on the public registry to reserve the name.
  3. After 24 hours, update the package with a higher version and a callback payload in install scripts.
  4. Wait for a callback from the target's build server or developer machine.
  5. Validate the callback by checking the source IP address against the target's ASN or ISP.

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.

Dependency confusion is a supply chain attack where a company uses a private package name that isn't registered publicly. An attacker can register that name on a public registry with a higher version number, so when developers install dependencies, they might download the attacker's malicious package instead of the internal one. This can lead to code execution on the company's systems.

What is RCE?

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

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.