Skip to content

Lesson 4 of 14 · 14m

The Maintainer Is the Attack Surface

event-stream to node-ipc: accounts get phished, handed off, expired, and turned — re-derive trust on every update.

Every package is a person with a password

event-stream was downloaded two million times a week in 2018 — a flat, boring streams utility maintained by Dominic Tarr for years. When a user named right9ctrl offered to take over maintenance, Tarr handed him npm publish rights. In September 2018 the new maintainer shipped event-stream@3.3.6, which added a dependency: flatmap-stream@0.1.1. That dependency's minified source contained an encrypted payload that decrypted at runtime only inside the build tree of Copay, BitPay's bitcoin wallet — where it stole private keys and sent them to a server. It was caught in November when a user traced a deprecation warning to the injected dependency and filed a GitHub issue. Nothing about the attack needed a vulnerability in code. It needed trust, and trust transferred with the account. Two million weekly downloads turned out to be a measure of exposure, not of safety.

How accounts actually fall

The takeover methods repeat because they work:

  • Credential reuse. The October 2021 coa / rc / ua-parser-js hijacks ran through maintainer npm accounts without 2FA — stolen or reused passwords, straight publish rights.
  • Token theft. eslint-scope@3.7.2 (July 2018) shipped a postinstall that mailed the victim's ~/.npmrc auth token to a pastebin — then used stolen tokens to publish eslint-config-eslint@5.0.2.
  • Expired infrastructure. PyPI's ctx and Packagist's phpass fell in May 2022 when the original authors' email domains lapsed; the attacker registered the domain, issued a password reset, owned the accounts.
  • The maintainer themselves. node-ipc (March 2022) shipped peacenotwar in versions 10.1.1/10.1.2 — code that overwrote files on machines geolocated to Russia/Belarus. vue-cli depended on it transitively. And in January 2022, Marak Squires deliberately broke his own colors (infinite garbage loop) and faker (6.6.6, emptied) packages in protest, breaking thousands of builds. Insider sabotage doesn't need an attacker at all.

The wrong mental model

"Popular packages with real maintainers are safe." Popularity measures download volume, and the trust you're actually extending is to whoever can publish the next version — an account, possibly an account that changed hands last Tuesday. Stars are not a control. Neither is history: event-stream had eight years of honest maintenance before 3.3.6.

The ecosystem has started to price this in. npm began requiring 2FA for high-impact packages in May 2022. PyPI rolled out mandatory 2FA — first for the top 1% of projects in August 2022, then for every publisher through 2023–2024. Trusted Publishing (PyPI's OIDC-based token-less publish from GitHub Actions, GA in 2023) removes the stored-API-token attack entirely.

What to do with that

  • Watch ownership, not just versions. npm owner ls <pkg> — when the owner list changes, treat the next release like a new package. Some teams diff npm view <pkg> time release metadata per bump for exactly this; tooling like Socket and Snyk flag maintainer changes as a first-class signal.
  • Cool down. Most poisoned releases get pulled within days. Renovate's minimumReleaseAge, Dependabot's cooldown option, and pnpm's minimumReleaseAge setting all exist to let the ecosystem find a bad release before your pipeline installs it. Set it to days, not hours, and exempt security fixes deliberately rather than never cooling down.
  • Diff the update. npm diff --diff=pkg@1.2.3 --diff=pkg@1.2.4 shows what you're actually about to run. For bumps that touch scripts, add binaries, or balloon in size, read it.
  • Prefer tokenless publishing upstream. A package published via OIDC trusted publishing can't ship from a stolen password — there is no password.

You don't audit a maintainer once at adoption. You re-derive trust on every update, because what updates is the account's current occupant — not the package's history.

Was this lesson helpful?

Sign in to rate

Keep reading

Related articles from the SudoSecurity blog.