← Lab /Security & privacy

Worm hijacks hundreds of npm packages, spreads via Bun and stolen tokens

A threat actor compromised hundreds of npm packages and used a Bun-based loader to steal credentials and propagate the malware.

Security & privacy Datadog Security Labs 4 Aug 2026 Disclosure Real-world evidence

Published as “Worm compromises hundreds of popular npm packages”

Why it matters

Enterprises must audit preinstall scripts in npm dependencies and monitor for unauthorized Bun executions to prevent credential theft and supply-chain propagation.

Summary

The researchers observed a malicious commit on August 4, 2026 that injected a preinstall script into the popular keyv npm package and quickly replicated the payload across dozens of other packages. The injected loader downloads and runs Bun, then executes a second-stage payload that harvests files, environment variables, cloud credentials, and GitHub tokens, exfiltrating the data via an Ethereum smart-contract dead-drop or a fallback GitHub repository. Evidence includes detailed GitHub commit timelines, code analysis of the loader and second stage, and enumeration of the credential-stealing modules, showing a real-world supply-chain attack affecting packages with up to 150 million weekly downloads.

What they found 2

  1. Hundreds of npm packages were compromised, some with massive download counts

    “On August 4, 2026, a threat actor compromised hundreds of npm packages and used them to propagate a backdoor.”

  2. The payload discovers C2 domains through an Ethereum contract dead-drop

    “The primary sender does not contain a fixed destination domain. Instead, it iterates a list of 73 Ethereum remote procedure call (RPC) endpoints and makes an eth_call to: Contract: 0xE1f2395ee43e45A1556EC6438a88c31B83493103”

Caveats 3

  • If provenance generation fails, the code still attempts a publish without the bundle.
  • The loader obtains an official Bun release asset but does not cryptographically verify it.
  • The Vault collector only checks the first 100 top-level keys per mount and skips nested keys ending in /, limiting its effectiveness.

What’s new here 4

  • First large-scale npm worm that leverages the Bun runtime to evade Node-specific defenses
  • Use of an Ethereum smart-contract as a dynamic C2 domain discovery mechanism
  • Automated propagation via stolen npm tokens and GitHub Actions workflow abuse
  • Inclusion of SLSA provenance generation to make malicious releases appear legitimate