npm

The event-stream npm Supply Chain Attack

Updated 5 Oct 2026 · Incident date 9 Sept 2018

event-stream 3.3.6 on npm added the dependency flatmap-stream, whose hidden code was built to steal bitcoin from Copay wallet users, from September 2018.

Versions 3.3.4 and 3.3.5 of event-stream were clean. The attacker got publish rights by gaining the trust of the original maintainer.

What happened

A new contributor took over event-stream, added a malicious dependency, and waited about a month to arm it.

  • 9 September 2018: event-stream 3.3.6 added the flatmap-stream dependency.
  • 5 October 2018: flatmap-stream 0.1.1 was released with the injected code.
  • The code decrypted a hidden blob. It used the npm_package_description environment variable as the key.
  • The payload ran only during build commands for iOS, Android or desktop.
  • It injected JavaScript into @zxing/library that collected data from wallets with more than 100 BTC or 1000 BCH.

event-stream 4.0.0 removed the dependency on 16 September 2018. npm removed flatmap-stream on 26 November 2018.

Affected versions

  • event-stream 3.3.6: the release that added the flatmap-stream dependency.
  • flatmap-stream 0.1.1: the version with the injected code. The GitHub advisory GHSA-9x64-5r7x-2q53 lists no patched version.
  • Copay 5.0.2 to 5.1.0: Snyk reports these app versions as compromised.
  • event-stream 3.3.4 and 3.3.5 were clean.

Indicators of compromise

  • The package name flatmap-stream at version 0.1.1 in node_modules or in a lockfile.
  • The file flatmap-stream/index.min.js, which contained the decryption code.
  • event-stream at version 3.3.6 in a lockfile.
  • Copay builds 5.0.2 through 5.1.0.

How to check

Search your dependency tree and lockfiles for flatmap-stream and for event-stream 3.3.6.

npm ls event-stream flatmap-stream
grep -rn "flatmap-stream" package-lock.json yarn.lock

The code ran only in builds of the target app. Check the build history for Copay as well.

What to do now

  1. Remove flatmap-stream from the project. Move event-stream to 4.0.0 or later, or remove it.
  2. Delete node_modules and the lockfile entries for flatmap-stream, then reinstall.
  3. If you build or use Copay 5.0.2 to 5.1.0, update to 5.2.0 and treat private keys as stolen, as Copay advised.
  4. Move funds to a new wallet with new keys if the old wallet used an affected version.

What Vigilance would show

These examples show an install hold and the corresponding owner report.

Example install message

Vigilance blocked `event-stream` 3.3.6. This version is too new or changed in a way Vigilance must check first.

Example owner report

Bad update

event-stream 3.3.6

The library can now unscramble a hidden blob, run it, and plant extra code inside a bitcoin wallet app.

See what to do now.

No security team? See who reads the alert.

Frequently asked questions

Which event-stream version was malicious?

event-stream 3.3.6 added the flatmap-stream dependency. The injected code was in flatmap-stream 0.1.1.

How do I check if I installed flatmap-stream?

Run npm ls event-stream flatmap-stream and search your lockfiles for flatmap-stream. Version 0.1.1 is the bad one.

Sources

  1. github.com/advisories/GHSA-9x64-5r7x-2q53
  2. github.com/dominictarr/event-stream/issues/116
  3. snyk.io/blog/a-post-mortem-of-the-malicious-event-stream-backdoor/

Send this page to the person who looks after AI at your company.

Email it

More supply chain attacks

All 172 attacks in the library · npm supply chain attacks · How to prevent supply chain attacks

Check the next update before you install it

Vigilance compares the version you trust with the new one. It names the one file that gained a power the old version did not have.

Start the free 14-day trialBrowse the attack library