Skip to content
RCE Disclosed report Intermediate

Dependency Confusion Vulnerability in Sifnode Due to Unclaimed npm Packages.

The sifnode project used npm packages that were not claimed on the public registry, allowing an attacker to publish packages with the same names. An attacker could then distribute malicious code to anyone installing the project, leading to remote code execution.

0xcachefl0w Follow

Originally disclosed on HackerOne

Informational View original
  • Disclosed after 7 months

Summary:

Hello, I've found a Dependency Confusion vulnerability in the sifnode project. The vulnerability allows me to claim previously unclaimed npm packages that are being used by the sifnode project, and serve malicious content in them which would allow me to gain remote code execution on anyone who installs the project.

Steps To Reproduce:

  1. Create an account on npmjs.org and publish two malicious packages with names sifchain-monorepo and testnet-contracts.
  2. Wait and watch as your malware is unknowingly distributed among thousands of users.

Supporting Material/References:

I claimed the package sifchain-monorepo a day ago and since then it has been downloaded over 300 times.

1.png
1.png From the original on HackerOne

Note that I did not make the package malicious as the scope only specified testing to be done in the source code, and putting malware inside the package would have affected hundreds of users, and I did not have the authorization to do so.

I have claimed the package testnet-contracts an hour ago too, but since it hasn't been over a day, I am not able to view the statistics.

2.png
2.png From the original on HackerOne

Mitigation

Once you have reviewed this report, I can unclaim the two packages and you can upload your own ones there. You can also ask developers to configure their machines such that it requests internal packages from internal or cloud based servers, instead of from npmjs.org which might contain malicious ones.

References

These are two excellent blog posts explaining the issue in detail: https://medium.com/@alex.birsan/dependency-confusion-4a5d60fec610 https://incolumitas.com/2016/06/08/typosquatting-package-managers/

Impact

Remote Code Execution on potentially thousands of users - including developers inside the organization.

Regards,

  • quas4r

The original report as published on HackerOne, by 0xcachefl0w. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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

How it worked

Root cause

Likely the project referenced internal npm packages by name without claiming them on the public registry, allowing an attacker to register those names and serve malicious code.

Impact

Remote code execution on potentially thousands of users, including developers inside the organization.

What the attacker needed

Npm account; knowledge of unclaimed package names

The fix

The reporter offered to unclaim the packages so the project could claim them, and suggested configuring developers to fetch internal packages from internal or cloud servers.

How it was found

  1. Create an account on npmjs.org and publish two malicious packages with names `sifchain-monorepo` and `testnet-contracts`.
  2. Wait and watch as your malware is unknowingly distributed among thousands of users.

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 report has not been written yet. The Original tab links to the source.

When a project uses a package from a public registry like npm, it relies on the package name. If the project uses a package name that is not yet taken on the public registry, an attacker can register that name and upload their own malicious version. Then, when someone installs the project, they unknowingly download and run 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 from Sifchain

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.