Join our Newsletter — 33% off our NHI Course

How did keyv and cacheable spread so quickly through npm?

 

(@nhi-mgmt-group)
Member Moderator
Joined: 2 years ago
Posts: 20842
Topic starter  

TL;DR: Malicious keyv and cacheable releases spread as a self-propagating worm, harvesting credentials from developer and CI machines before republishing to other packages, according to Cloudsmith. Install-time code execution turns ordinary dependency installs into an attack path that can reach publishing tokens and downstream builds.

Editorial analysis by NHI Mgmt Group, based on content published by Cloudsmith: “Keyv and Cacheable npm packages compromised in active supply-chain attack”.

By the numbers:

  • The attack had grown to 2,236 package versions by the time Cloudsmith published its analysis.
  • Roughly 444 legitimate packages were affected in the campaign Cloudsmith tracked.

Key questions

Q: Why do transitive dependencies create more software supply chain risk than direct packages alone?

A: Transitive dependencies hide exposure inside nested libraries that are often missed by top-level package reviews.

Q: How does install-time code execution expose build credentials?

A: Install-time code execution exposes build credentials when a package, installer, or setup script runs with the privileges and network access of the build environment, letting attacker-controlled code read environment variables, files, or secret stores.

Q: How should teams reduce risk from malicious npm package installs?

A: Treat package installation as a controlled operation, not an implicit trust event.

Practitioner guidance

  • Disable lifecycle scripts where they are not required Prevent preinstall and other lifecycle hooks from running in developer and CI environments unless a package truly needs them for build-time behaviour.
  • Enforce registry cooldowns for newly published packages Hold back recently published upstream versions long enough for community review, especially for common transitive dependencies with large downstream reach.
  • Quarantine affected versions in your internal proxy Block malicious or suspicious package versions at the registry boundary and ensure cached copies cannot be pulled into fresh builds.

Bottom line: The incident shows that a package compromise becomes materially worse when malicious code can execute during install and steal publish credentials.

Glossary terms: Keyv and Cacheable npm Supply-Chain Attack, Install-Time Script, Transitive Dependency, Publishing Token

Explore further

View Full Forum →  |  NHI Foundation Course →  |  Our Services →  |  Read the full analysis →



   
Quote
(@mr-nhi)
Member Moderator
Joined: 7 months ago
Posts: 21330
 

Supply-chain trust collapses when execution and distribution happen in the same install step. npm ecosystems have long relied on package reputation and lockfile discipline, but this campaign shows that trust is broken earlier, at install time. Once a package can execute code during installation, the registry becomes part of the runtime attack surface, not just a source of artifacts. Practitioners should treat package admission as an execution decision, not a download decision.

A few things that frame the scale:

A question worth separating out:

Q: What is the best way to contain a self-propagating supply-chain worm?

A: A self-propagating supply-chain worm is contained by cutting its automated reach, usually with a controlled proxy, egress filtering, package allow-lists, and rapid revocation of build or publishing tokens. Isolate affected runners, block unauthorised dependency fetches, freeze release pipelines, and rotate any credentials that the worm could reuse to spread further.

👉 Read our full editorial: Keyv and cacheable worm through npm by abusing dependency trust



   
ReplyQuote
Share:

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.