flatmap-stream malicious package (distributed via the popular events-stream)
A malicious npm package was added as a dependency of the popular event-stream package after its ownership was transferred to a new maintainer. The report states the malicious code could lead to remote code execution, though what it actually did was not yet clear.
Originally disclosed on HackerOne
- Disclosed after 4 hours
I would like to report a case of malicious package (flat-stream) that made it's way into many other npm packages. One such popular package is event-stream (user dominictarr transferred the ownership of an npm module to another user because he wasn't actively maintaining it. That user then added malicious dependency to the package)
See discussion here: https://github.com/dominictarr/event-stream/issues/116
Module
module name: flatmap-stream
version: [MODULE VERSION]
npm page: https://www.npmjs.com/package/flatmap-stream (removed from npm by now)
Module Description
It is not yet clear what the malicious code was doing. See discussion here: https://github.com/dominictarr/event-stream/issues/116#issuecomment-441737695
Module Stats
Replace stats below with numbers from npm’s module page:
flatmap-stream is not popular, but event-stream is very popular (1,996,440 downloads per week)
Impact
RCE
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 a change of ownership of a popular package allowed a new maintainer to add a malicious dependency that downstream users installed automatically.
Impact
The report claims the malicious code could lead to remote code execution, but states it is not yet clear what the code was doing.
What the attacker needed
Install event-stream with the bad dependency
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 you install a software package, it can pull in other packages it depends on, and those can pull in more. Here, someone took over a widely used package and quietly added a harmful dependency, so many projects installed it without knowing. The report says this could let an attacker run their own code on affected machines, though the details were still being worked out.