Skip to content
RCE Write-up Advanced

I Hacked Microsoft: Remote Code Execution (RCE) via Dependency Co

An internal Microsoft NPM package scope was not registered on the public registry, allowing the researcher to publish a malicious package with a higher version number. The build server downloaded and executed the package, confirming remote code execution via DNS callback.

Aman Kumar Follow

Published on sudoaman.medium.com

If you have been following cybersecurity news, you might have heard the term “Supply Chain Attack.” It sounds complex, but the concept is actually terrifyingly simple:

Aman Kumar (ak), on sudoaman.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

Impact

The researcher could have stolen source code, dumped secrets, or poisoned the supply chain, but the build agent was internal and the package was unpublished quickly.

What the attacker needed

Internal package name leaked via source maps; public NPM scope unregistered; build system prioritises higher version

The fix

Microsoft registered the scope on the public NPM registry, and the researcher unpublished the malicious package.

How it was found

  1. Scan Microsoft subdomains with a headless browser to capture HAR files containing source maps.
  2. Parse source maps to extract internal package names like @bingads-webui-clientcenter/instrumentation.
  3. Check that the package and its scope are unclaimed on the public NPM registry.
  4. Create a package.json with the same name, a high version number, and a preinstall script.
  5. Publish the package publicly and wait for a build to trigger.
  6. Receive DNS callbacks confirming code execution on the build server.

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.

When software is built, it downloads other pieces of code called packages. If a company uses a private package name but hasn't reserved that name publicly, an attacker can publish a package with the same name and a higher version number. The build system then downloads the attacker's package instead of the internal one, running the attacker's code.

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 Aman Kumar

View all

1 more disclosed report, 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.