Package Planting: Are You [Unknowingly] Maintaining Poisoned Packages?
npm allowed any user to add other users as maintainers of a package without their consent or notification. An attacker could create a malicious package and add trusted maintainers to make it appear legitimate, potentially tricking developers into installing it.
Published on blog.aquasec.com
Aqua’s Team Nautilus found a logical flaw in npm that allows threat actors to masquerade a malicious package as legitimate and trick unsuspecting developers into installing it. Up until recently, npm allowed adding anyone as a maintainer of the package without notifying these users or getting their consent.
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 lack of a confirmation step when adding a new maintainer to an npm package, allowing arbitrary users to be assigned without consent.
Impact
An attacker could make a malicious package appear legitimate by adding trusted maintainers, potentially tricking developers into installing it; the text also notes a defamation scenario where added developers could be reported and banned.
What the attacker needed
An npm account; ability to publish a package
The fix
npm fixed the flaw by adding a confirmation mechanism: new maintainers must accept an email invitation before being added.
How it was found
- Create and publish an npm package with a chosen name.
- Add the users you wish to incriminate as owners.
- Remove yourself from the package.
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.
In npm, the main package manager for JavaScript, a package can have multiple maintainers. The bug was that you could add someone as a maintainer without them agreeing. This let attackers make a bad package look trustworthy by putting famous developers' names on it.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.