Explore our new Cybersecurity Terms Glossary, explained by our experts.

View the Glossary View the Glossary
PRIVIA

Cybersecurity Terms Glossary

What Was the event-stream Package Attack?

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.

Illustration for the cybersecurity term event-stream Package Attack
Home / Blog / Cybersecurity Terms / What Was the event-stream Package Attack?
17 November 2026

What Was the event-stream Package Attack?

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.

How the Takeover Happened

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 Payload

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.

Discovery

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.

What It Changed

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:

The Uncomfortable Part

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.

FAQ – Frequently Asked Questions

How Did the Attacker Gain Control of the Package?

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.

Why Did the Malicious Code Only Affect One Application?

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.

Would a Lockfile Have Prevented This?

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.

How Should We Manage Dependency Risk Now?

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.

Related Terms

You May Be Interested In These

What Is a Security Data Lake?

Cybersecurity Terms

17 November 2026

What Is a Security Data Lake?

Read More
What Is ISO 22301?

Cybersecurity Terms

17 November 2026

What Is ISO 22301?

Read More