Skip to content
RCE Write-up Intermediate

MSRC is confused! πŸ˜•

The researcher found that an npm package named 'swift-search' was listed as an optional dependency in a Microsoft-related GitHub repository but was not published on the public npm registry. They published a malicious package with the same name, and when Microsoft's build system installed it, the preinstall script executed, allowing command execution on a Microsoft server. The researcher reported this to MSRC, but MSRC initially said it was not their issue and later did not provide a fix.

Ricardo Iramar dos Santos Follow

Published on web.archive.org

Ricardo Iramar dos Santos

Ricardo Iramar dos Santos, on web.archive.org

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 attacker could execute arbitrary commands on a Microsoft server, potentially leading to further compromise, though the text does not specify the full extent of the impact.

What the attacker needed

The target uses a private npm package not published publicly; The attacker can publish a package with the same name; The build system installs dependencies from the public…

How it was found

  1. The researcher found a package.json file in a Microsoft-related GitHub repository that listed 'swift-search' as an optional dependency.
  2. They noticed that 'swift-search' was not published on the public npm registry, so they published their own package with that name and a preinstall script.
  3. After some hours, they received DNS queries and a POST request from Microsoft IP addresses, indicating the package was installed and the script executed.
  4. They extracted environment variables from the server, confirming command execution.

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.

This is a 'dependency confusion' attack. A company's internal software project uses a private package (a reusable code module) with a certain name. If that name is not registered on the public package repository, an attacker can register it there. When the company's build system tries to install the private package, it may accidentally download the attacker's public version instead, 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 Ricardo Iramar dos Santos

View all

3 more disclosed reports, best first.

More from Microsoft

View all

The newest disclosed reports for this program.

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.