All articles
Vulnerability landscapeAwarely Monitor editorial team9 min

The keyv/cacheable npm worm: how to check if you are affected

On 4 August 2026, at around 09:00 UTC, a compromised maintainer account republished ten npm packages from the `keyv` and `cacheable` families with a malicious `preinstall` hook. `keyv` alone sees roughly 127 million weekly downloads.

The payload steals credentials and immediately uses them to publish itself into further packages. Within hours it had reached more than 400 distinct, unrelated packages.

This post gives you the exact commands to check whether you are affected, and explains why the usual reflex — "I will verify the signatures" — would not have helped anyone here.

Why provenance saved nobody

The attacker pushed the malicious files straight to each repository's `main` branch and immediately cut a release from it. The result: the poisoned versions were published to npm carrying perfectly valid provenance signatures generated by GitHub Actions.

This is worth understanding correctly. Provenance proves *where* a package came from, not that it is clean. When the attacker controls the source, the proof of origin becomes their proof, not yours. `npm audit signatures` would have reported everything in order.

What the payload actually does

It is a descendant of the Shai-Hulud family. It runs at install time, before you execute a single line of the package's own code.

  • ▸Steals cloud credentials, SSH keys and CI/CD secrets.
  • ▸Hunts for AI agent configurations — Claude, OpenAI, Cursor, Gemini.
  • ▸Extracts cryptocurrency keystores and reads system files.
  • ▸Establishes persistence through Claude Code hooks and VS Code `tasks.json`.
  • ▸Exfiltrates to GitHub repositories under the compromised identities.
  • ▸Pulls its command-and-control domains from an Ethereum smart contract, so they can be rotated without redeploying the malware.

The ten-second check

The first question is not "do I have these packages?" but "which versions am I pinned to?". The affected families — `keyv`, `cacheable`, `flat-cache`, `file-entry-cache`, `cache-manager`, `cacheable-request` — enter almost any JavaScript project transitively, usually through ESLint. Their presence means nothing. The version does.

  • ▸`npm ls keyv cacheable flat-cache file-entry-cache cache-manager cacheable-request` — shows the versions you actually have, transitive ones included.
  • ▸`npm ls --all 2>/dev/null | grep -E "keyv|cacheable|flat-cache|file-entry-cache"` — the variant that catches deeply nested dependencies.
  • ▸`npm view keyv time.6.0.0` — tells you when a given version was published. Treat anything published on or after 4 August 2026 as suspect until proven otherwise.

The check that actually matters

The worm spread to over 400 packages unrelated to the original. So checking a list of known-bad names is not enough — you have to ask a different question: did I install any version published during the attack window?

Run this at your project root. It queries the npm registry for the publish date of every version your lockfile pins, and reports anything from August 2026:

  • ▸Extract every name@version pair actually installed from `package-lock.json`.
  • ▸For each, fetch `https://registry.npmjs.org/<name>` and read `time[<version>]`.
  • ▸Flag anything dated 4 August 2026 or later.
  • ▸An empty result is the answer you want: no installed dependency originates from the attack window.

Check for persistence, not just packages

Because the payload leaves persistence behind, a clean `npm ls` is not sufficient if you installed anything during the window. Check the hooks in `~/.claude/settings.json` and `.claude/settings.json`, any VS Code `tasks.json`, and `~/.npmrc` for tokens.

If you find something you did not put there: rotate every credential on that machine — cloud, GitHub, SSH, npm — and rebuild the system. A preinstall hook runs with your full privileges, not in a sandbox.

What actually protects you

The order below is by protection-per-effort, not by how impressive it sounds.

  • ▸The lockfile. This is the control that held for most teams who came through untouched. Pinned versions do not update themselves, and the attack published *new* versions — npm does not allow overwriting an existing one.
  • ▸`npm ci` instead of `npm install`, everywhere you build something that reaches production. `npm install` may resolve something newer and rewrite the lockfile; `npm ci` installs exactly what is written there and fails if it has drifted.
  • ▸`--ignore-scripts`. The payload was a `preinstall` hook. Disabling install scripts removes the entire class. Check first which packages genuinely need them — in many projects the answer is "one, a native compiler".
  • ▸A cooldown on updates, not on builds. A 7-14 day delay before adopting new versions covers the realistic detection window; this attack was identified within hours. Renovate's `minimumReleaseAge` does exactly this.
  • ▸Credential-free build environments. If the environment running the install holds no secrets, a malicious hook has nothing to steal.

Why "nothing newer than a month" is the wrong shape

The instinctive reaction to an incident like this is a policy along the lines of "we do not install anything published in the last month". It sounds prudent, but it solves the wrong problem.

If you have a lockfile you are already not resolving new versions on every install — you have that protection. A cooldown only matters at the moment you update. And a month of delay on security patches exposes you in the other direction: critical vulnerabilities are exploited in days, not months.

The useful rule is narrower: delay adopting new versions by 7-14 days, do not delay patches flagged as security fixes, and do not touch builds that install from the lockfile at all.

How to monitor CVEs and get alerts for products in your inventory