Explore our new Cybersecurity Terms Glossary, explained by our experts.
Cybersecurity Terms Glossary
In 2018 an attacker took over a popular npm package by volunteering to maintain it, then added code that stole bitcoin wallet keys from exactly one downstream application.

What Was the event-stream Package Attack?
In November 2018 the npm package event-stream, downloaded around two million times a week, was found to contain code that stole cryptocurrency private keys. The attacker had not broken into anything. They had asked the maintainer, politely, whether they could take over the project, and had been given publishing rights.
The case is studied less for its technical sophistication — though the payload was unusually careful — than for what it exposed about the economics of open source maintenance.
event-stream was written by Dominic Tarr, who had long since stopped using it. In September 2018 a GitHub account named right9ctrl, with a plausible history of small contributions, offered to maintain it. Tarr handed over publishing rights. His later comment on the incident was blunt and entirely fair: he had given the package away for free, had not used it for years, and owed its users nothing.
That is the structural problem. A package depended on by thousands of commercial products was maintained, unpaid, by someone with no remaining interest in it, and the only available succession mechanism was trust in a stranger.
The new maintainer published a few legitimate updates, then on 9 September 2018 released version 3.3.6, which added a dependency on a new package called flatmap-stream. That package contained an encrypted blob.
The decryption key was not in the code. It was derived from the description field of the package.json of whichever package was consuming it. The payload therefore decrypted successfully only inside one specific application: Copay, a bitcoin wallet from BitPay. Anywhere else, decryption produced noise and the code did nothing.
Inside Copay, the decrypted code hooked the wallet, harvested private keys and mnemonic seeds for accounts holding more than 100 bitcoin, and sent them to a server in Kuala Lumpur. The targeting was deliberate, narrow, and designed so that security researchers running the package in isolation would see nothing at all.
It was found on 20 November 2018 by a developer, Ayrton Sparling, who filed a GitHub issue after noticing that flatmap-stream contained minified code that did not match its source repository. The package had been live for over two months. The npm registry removed it, BitPay published advisories for affected Copay versions, and the account behind the takeover vanished.
The incident is a foundational case in modern supply chain attack discussion, alongside the Codecov compromise and later npm events such as the ua-parser-js and node-ipc incidents. Several practices that are now standard trace back to it or to the cluster of attacks around it:
No technical control in place at the time would have caught this. The code was published legitimately, by the recognised maintainer, through the official registry, and was encrypted so that it did nothing in any environment a researcher was likely to use. Detection came from one person reading minified code and finding it did not match the repository.
That argues for defence in depth around the build rather than faith in any single gate: restricted build-time network access, least-privilege credentials in pipelines, provenance verification, and monitoring for unexpected outbound connections from applications in production.
Dependency and build pipeline review is part of our application security services.
By asking. The original maintainer had not used the package for years, and a GitHub account with a plausible contribution history volunteered to take it over. Publishing rights were transferred voluntarily. No credentials were stolen and no system was breached, which is why the case is usually discussed as a social and sustainability problem rather than a technical one.
The payload was encrypted, and the decryption key was derived from the description field of the consuming package’s manifest. It decrypted correctly only inside the Copay bitcoin wallet. Anywhere else, including in a researcher’s sandbox, decryption produced garbage and nothing happened. That targeting kept it hidden for more than two months.
It would have made the change visible. A committed lockfile means a new transitive dependency appears as a diff in a pull request rather than arriving silently on the next install. Whether anyone reviews that diff is a separate question, but visibility is the precondition. Pinning plus a delay before adopting new releases is the practical combination.
Commit lockfiles, review transitive dependency changes, delay adoption of brand-new versions, verify provenance attestations where the registry supports them, maintain a software bill of materials, and restrict what build agents can reach on the network. For dependencies that are critical and unmaintained, consider vendoring the code or funding the maintainer.
You May Be Interested In These
We use a few cookies that are needed to make this website work, and they are always on. We would also like to set analytics cookies, to see which pages are useful; functional cookies, so that our live chat works; and advertising cookies, to measure our campaigns. We will not set any of those until you say yes, and you can change your mind at any time from the Cookie Settings link in the footer.
Choose the cookies you are happy for us to use. Strictly necessary cookies are always on; everything else is off until you turn it on.
These cookies keep the website working: they hold your security checks, your form submissions and the choice you make here. The site cannot run without them, so they are always on.
These let our live chat open and remember your conversation, and let the newsletter sign-up work. Switch them off and the chat window will not appear.
These tell us which pages are read and how people find us, so that we can improve the site. The reports are about groups of visitors, never about you personally.
These let us measure our advertising and show you our adverts on other websites, such as LinkedIn, Google and Meta. Switch them off and you will still see adverts, but they will be less relevant.