Keyv npm Worm Poisoned 444 Packages: Check Before Rotating Tokens

Brendan Smith
Brendan Smith - Cybersecurity Analyst
6 Min Read
Keyv npm worm spreading from keyv 6.0.0 through a dependency network.
The Keyv npm worm spread through poisoned package releases and developer-tool hooks.

An active npm supply-chain worm that surfaced through keyv and cacheable poisoned hundreds of package names on August 4, 2026. SafeDep recorded 2,234 malicious versions across 444 packages between 09:35 and 13:18 UTC, while Socket and Aikido independently tracked the initial Keyv-family compromise [1][2][3].

If a developer machine or CI runner installed one of those releases, do not begin by revoking GitHub tokens from the same host. The analyzed payload can install a watcher that reacts when a stolen token stops working. Isolate the system and remove that persistence first; rotate credentials afterward from a clean device.

Who needs to check

Check projects that resolved [email protected], affected cacheable packages, or later poisoned versions from scopes such as @ornikar and @hubsync. Direct dependencies are not the only path: flat-cache and file-entry-cache are used through ESLint, so a project may be exposed without listing Keyv by name.

The registry state can no longer answer the whole question. Some malicious versions were unpublished, but they may remain in lockfiles, CI caches, and existing node_modules directories. SafeDep also found that latest still pointed to a poisoned release for many names during the investigation. Compare the exact resolved version and its lifecycle scripts instead of assuming that an update is clean.

What happened Risk and next decision
The package appears only in a lockfile and was never installed Block installation, replace the poisoned resolution, clear dependency caches, and regenerate the lockfile from a trusted source.
npm install ran on a workstation or CI runner Treat the host and credentials available to that process as exposed. Isolate it before rotating tokens.
The Keyv repository was cloned but never opened Cloning alone does not trigger the reported hooks. Inspect the checkout without opening it in VS Code or Claude Code.
The checkout was opened in VS Code or a Claude Code session The planted task or session hook could have run even without npm install. Triage the host as potentially compromised.

How the Keyv npm malware runs

Each poisoned release added a preinstall command that launched setup.mjs before application code ran. Researchers found collection logic for GitHub and npm tokens, cloud credentials, Vault and Kubernetes tokens, database URLs, private keys, and secrets exposed in GitHub Actions runner memory.

The Keyv repository added a second execution path. A malicious .vscode/tasks.json task and .claude/settings.json session hook pointed to local setup scripts, so merely opening the repository in an editor or coding-agent session could start the same chain. A verified GitHub commit and valid SLSA provenance did not make the release safe: the real workflow built attacker-controlled source.

This is a newer exact-package incident than the earlier Shai-Hulud AntV wave. The same lesson applies, but the Keyv case expands the decision tree to IDE hooks and a token-revocation trigger.

Respond in the right order

  1. Isolate affected developer machines and runners. Pause package publishing and deployment workflows that used the same identities.
  2. Hunt the token watcher before revocation. Check ~/.config/gh-token-monitor/, the macOS LaunchAgent com.user.gh-token-monitor, and the user service gh-token-monitor.service. Remove the unit and disable lingering where it was enabled.
  3. Inspect dependency and repository artifacts. Search lockfiles, caches, and node_modules for affected names, setup.mjs, Math_Symbol.js, or math_init.js. Sweep reachable repositories for .claude/settings.json, .claude/setup.mjs, .vscode/tasks.json, .vscode/setup.mjs, a workflow named Run Copilot, and toJSON(secrets).
  4. Rotate from a clean system. Replace GitHub PATs and app tokens, npm tokens, cloud and Vault credentials, Kubernetes service-account tokens, database secrets, and private keys available to the compromised process.
  5. Rebuild rather than trust an uninstall. Remove dependency caches and working copies, reinstall only verified clean versions with lifecycle scripts disabled where practical, and review package-publishing history for unexpected releases.
  6. Review source integrity. Follow the same repository checks used when malware changes Git commits, including protected branches, workflow files, deploy keys, and downstream clones.

What not to assume

  • “The package was unpublished, so we are safe.” Lockfiles and caches can preserve an unpublished malicious version.
  • “The release has provenance, so it is clean.” Provenance can accurately attest that a compromised trusted workflow built poisoned source.
  • “We rotated the token, so the incident is over.” In this campaign, token revocation may trigger the installed watcher unless responders remove it first.
  • “We never ran npm install.” Opening the compromised Keyv checkout in supported developer tools could execute the planted repository hooks.

For future releases, npm’s staged publishing and install-source controls can reduce exposure, but they do not replace host triage after a malicious install already ran.

References

  1. SafeDep Team. “npm Worm Poisons keyv, cacheable and 400+ Other Packages Across Twelve Organisations.” SafeDep, August 4, 2026; accessed August 4, 2026. Research and affected-version inventory.
  2. Socket Research. “Popular npm Packages in the keyv and Cacheable Namespaces Compromised in Active Supply Chain Attack.” Socket, published August 4, 2026, updated August 4, 2026; accessed August 4, 2026. Incident analysis.
  3. Aikido Security. “Keyv and Friends Compromised in npm Supply Chain Attack.” Aikido, August 4, 2026; accessed August 4, 2026. Package and maintainer-account findings.
Share This Article
Cybersecurity Analyst
Follow:
Brendan Smith has spent over 15 years knee-deep in cybersecurity, chasing down malware from the gritty reverse-engineering of old-school trojans all the way to wrangling full-blown incident responses for small-to-medium businesses that couldn’t afford a full-blown breach. Over at Gridinsoft, he’s the guy piecing together those double-checked guides on nasty stuff like AsyncRAT ransomware—take last year, for instance, when his breakdowns caught more than 200 sneaky variants right in live scans, knocking user cleanup jobs down by a solid 40% and saving folks hours of headache.
Leave a Comment

AI Assistant

Hello! 👋 How can I help you today?