keyv / cacheable npm Worm, "ChainDrop" (August 2026)
At 09:35 UTC on 4 August 2026, keyv@6.0.0 was published to npm. It came out of keyv's normal GitHub Actions release pipeline, used npm trusted publishing (OIDC) and carried a genuine SLSA provenance attestation. It also had a new preinstall hook that ran an obfuscated credential stealer. Within about four hours the same payload appeared in nine more packages by the same maintainer (cacheable, flat-cache, file-entry-cache, cache-manager and others). Then it spread into hundreds of unrelated packages from at least a dozen organisations, because the malware republished every package any stolen npm token could write to.
Several things make this incident worth studying even after the Shai-Hulud worms of 2025 and the TanStack compromise of May 2026:
- Provenance worked exactly as designed, and it did not help. The attacker controlled the source repository, so the trusted build pipeline honestly attested a malicious build.
- The worm did not need
npm installto run. It wrote.claude/settings.jsonand.vscode/tasks.jsonhooks into up to 50 branches per repository, so opening a checkout in VS Code or Claude Code could run the payload. - It carried a dead-man's switch. A persistence component watched the stolen GitHub token and ran a handler when the token was revoked. The usual first move, "rotate everything now", could set it off.
- npm v12 had shipped four weeks earlier with dependency install scripts off by default, but most installs that day were still on npm v11 or earlier.
What is and is not known
As of this page's review date (2026-11-09), the maintainer has not published an account of how the GitHub account or credential was compromised, and no actor has been confirmed. The package and version counts differ between researchers (see "How big was it?" under Impact). Where sources disagree, this page says so instead of picking one.
TL;DR
| What | Self-propagating npm credential-stealing worm seeded through the keyv / cacheable maintainer's GitHub account |
| When | 4 August 2026, first malicious commit 09:02:37 UTC, first poisoned publish 09:35 UTC, last known worm publish 13:18:05 UTC |
| Entry point | Compromised jaredwray GitHub account "or a credential held by it" (cacheable#1692). Exact vector unknown |
| Trigger | "preinstall": "node setup.mjs", plus IDE auto-run hooks in .claude/ and .vscode/ |
| Payload | Bun-run obfuscated stealer: npm, GitHub (including Actions runner memory and OIDC), AWS, GCP, Azure, Kubernetes, Vault, SSH keys, .env files |
| Spread | Every npm package the stolen token could publish got a patch bump plus the payload, and was republished |
| Scale | 444 package names. 1,381 versions (Aikido) or 2,234 versions (SafeDep). Over 2 billion combined monthly downloads |
| Names | "ChainDrop" (Microsoft, Datadog, Singapore CSA), "Mini Shai-Hulud" (Aikido, Chainguard, Microsoft's description). Drop repos labelled "Shai-Hulud: Here We Go Again" |
| Key lesson | Provenance proves where a package was built, not whether it is safe. Defend the source repo and the release gate, block install scripts, add a release-age cooldown, and remove persistence before you rotate |
The Alert
The first public signal was in the repository itself. Datadog Security Labs reconstructed the keyv repository's history: at 09:08:18 UTC, six minutes after the first malicious commit, someone commented on the attacker's pull request: "Do not merge or publish until the repository and credentials are investigated" (Datadog). The attacker ignored it. They closed the PR with "Closing: merging directly to main" and pushed the payload straight to main.
Security researcher Lidor Machluf (Upwind Security) filed reports on the keyv tracker (keyv#2044 to #2047). All four were then deleted. The GitHub API returns HTTP 410 for them. He re-filed the report as jaredwray/cacheable#1692. Deleting issues needs repository admin rights, so the reporter noted this narrowed the actor down to "the compromised credential, the maintainer, or GitHub staff" without telling them apart.
Microsoft Threat Intelligence, Datadog, Aikido, Chainguard, SafeDep and Socket all published analyses on 4 and 5 August. No source credits one party with first detection. SafeDep explicitly says the first reporter is not stated.
The terrifying part
The poisoned keyv@6.0.0 was not published with a stolen npm token. It went through the project's own trusted-publishing pipeline, so npm audit signatures and provenance checks passed. Every signal designed to say "this came from the real repo's real CI" was true. The real repo was the problem.
Timeline
All times are UTC on 4 August 2026 unless noted. Commit hashes are shortened. Datadog and the cacheable#1692 reporter attach different hashes to the first commit (29c773… and ee2681a9…), and both are given where relevant.
| Time (UTC) | Event | Source |
|---|---|---|
| 22 May 2026 | Exfiltration fallback domain npm-cache[.]com registered | Aikido |
| 8 Jul 2026 | npm v12 GA, with dependency install scripts off by default (soft skip) | Socket, GitHub discussion #198547 |
| 3 Aug, 19:21 | keyv@6.0.0-rc.1 published, clean | cacheable#1692 |
| 09:02:37 | Unsigned commit adds setup.mjs, Math_Symbol.js, a preinstall script and a test that calls the loader | Datadog, SafeDep |
| 09:03:24–09:03:44 | Branch release/v6.0.0-latest-config created, keyv PR #2042 opened | Datadog |
| 09:04:27–09:04:31 | Five commits attributed to github-actions[bot], shown as verified, add .claude/.vscode hooks to v5, v4, the release branch, main and another branch | Datadog, cacheable#1692 |
| 09:04–09:54 | 18 commits titled "chore: update config". Only one changes files, the rest are decoys | cacheable#1692 |
| 09:08:18 | Comment warns: "Do not merge or publish until the repository and credentials are investigated." | Datadog |
| 09:13:25–09:13:27 | Hooks restored, PR #2043 closed with "Closing: merging directly to main" | Datadog |
| 09:14:58–09:18:28 | Unsigned commit replays the 27-file payload delta onto main | Datadog |
| 09:23:50 | Commit deletes only the 22-line test that invoked the loader. The hook stays | Datadog, SafeDep |
| 09:29:50–09:35:01 | Genuine SLSA provenance recorded in the Rekor transparency log. keyv@6.0.0 published at 09:35:00 | Datadog |
| 09:39:45 | Commit stages the payload into all 19 @keyv/* workspace packages. Not published | SafeDep, cacheable#1692 |
| 10:06:08–10:07:17 | Commit on cacheable reuses the payload across ten workspaces. Release setup-files-v1 published | Datadog |
| 10:09:44–10:14:41 | Nine cacheable-family versions published by GitHub Actions | Datadog |
| 10:12–10:46 | Packages from eight other organisations published at about one per second | SafeDep |
| 10:28:01 | ecto@5.0.1 published | Datadog |
| 11:28:45 | keyv GitHub Release object finally published, about two hours after the npm publish | Datadog |
| ~11:31 | Reporter observes 5 unscoped poisoned versions removed from the registry. @cacheable/*, file-entry-cache and ecto still live | cacheable#1692 |
| 13:18:05 | Last known worm publish (Umacloud) | SafeDep |
| 4 Aug | Microsoft, Datadog, Aikido and Chainguard publish analyses | see Sources |
| 5 Aug, 13:15 CEST | Aikido update: at least 444 packages and 1,381 versions, over 2 billion monthly installs | Aikido |
| 5 Aug | Maintainer posts remediation summary and closes cacheable#1692. Datadog adds C2 domain awqhnjewqjkl[.]icu | cacheable#1692, Datadog |
| 6 Aug | Singapore CSA advisory AD-2026-009 | CSA |
sequenceDiagram
participant A as Attacker (jaredwray credential)
participant GH as GitHub keyv repo
participant CI as GitHub Actions release
participant NPM as npm registry
participant V as Victims (dev + CI)
participant R as Researchers
A->>GH: 09:02 payload commit (setup.mjs, preinstall)
A->>GH: 09:04 bot-attributed hook commits on 5 branches
R->>GH: 09:08 comment - do not merge or publish
A->>GH: 09:14 replay payload onto main
GH->>CI: push triggers release workflow
CI->>NPM: 09:35 keyv@6.0.0 with valid SLSA provenance
A->>CI: 10:09-10:14 nine cacheable-family publishes
V->>NPM: npm install resolves poisoned patch versions
NPM-->>V: preinstall runs node setup.mjs
V->>NPM: stolen tokens republish victims' own packages
Note over V,NPM: 10:12-13:18 worm publishes across about 12 orgs
R->>R: 4-5 Aug Microsoft, Datadog, Aikido, Chainguard reports
NPM->>NPM: poisoned versions removed, clean versions restored as latest
Impact
Seed packages (same maintainer)
These versions were confirmed poisoned by the reporter, Datadog, Aikido and CSA. The "last clean" column comes from cacheable#1692.
| Package | Poisoned | Last clean | Monthly downloads (Aikido) |
|---|---|---|---|
keyv | 6.0.0 | 5.6.0 (or 6.0.0-rc.1) | 604M |
flat-cache | 6.1.24 | 6.1.23 | 580M |
file-entry-cache | 11.1.6 | 11.1.5 | 571M |
cacheable-request | 13.0.20 | 13.0.19 | 137M |
@cacheable/utils | 2.5.1 | 2.5.0 | 34M |
cacheable | 2.5.1 | 2.5.0 | 30M |
@cacheable/memory | 2.2.1 | 2.2.0 | 28M |
cache-manager | 7.2.10 | 7.2.9 | 16M |
@cacheable/node-cache | 3.1.2 | 3.1.1 | 6M |
@cacheable/net | 2.1.1 | 2.1.0 | 3.7K |
ecto | 5.0.1 | (not stated) | 4.5K |
flat-cache and file-entry-cache are deep transitive dependencies of common lint tooling, which is why the monthly numbers are so large. SafeDep notes that many projects pull them in through ESLint. The cacheable#1692 reporter first said ESLint users were exposed, then withdrew that claim: ESLint's dependency ranges could not resolve to the poisoned versions. That is a useful reminder that a big transitive download count does not mean everyone resolved the bad version. Your semver ranges and lockfile decide that.
How big was it?
The researchers counted different things at different times:
| Source | Packages | Versions | Notes |
|---|---|---|---|
| Microsoft | "more than 400" | not given | Its mitigation section also mentions "the five compromised versions", unexplained |
| Aikido (5 Aug update) | at least 444 | 1,381 | "over 2 billion monthly installs" |
| SafeDep | 444 names | 2,234 | Credentials from 12 organisations. ServiceTitan 147 names / 1,082 versions, OneReach 155 / 487, Ornikar 47 / 537 |
| Singapore CSA | n/a | "more than 1,300" | About 2 billion monthly downloads |
| Chainguard | "roughly 400 to over 2,200 packages and artifacts" | n/a | "No verified complete list exists" |
The package count of about 444 is consistent. The version count is not (1,381 vs 2,234), probably because of different cut-off times and counting methods. Nobody has published a figure for how many machines actually ran the payload. Aikido counted about 1,300 public GitHub "dead-drop" repositories and SafeDep "over 1,000". Each one is evidence of at least one successful exfiltration via the GitHub fallback, but neither is a victim count.
What was stolen
According to Microsoft, Datadog and Aikido, the stealer went after:
- npm tokens, checked live against the registry's
whoamiendpoint so only working tokens were kept - GitHub tokens (
ghp_,gho_,ghs_,gh auth tokenoutput) and, on Actions runners, theRunner.Workerprocess memory, to recover masked secrets and the OIDC request token - Cloud credentials from files, environment variables and metadata services. Commands such as
gcloud config config-helper,az account get-access-tokenandazd auth token. AWS STS, Secrets Manager and SSM in many regions (Datadog: 17) - Kubernetes service-account tokens, kubeconfigs and namespace secrets
- HashiCorp Vault tokens, then KV secrets
- Files matching hundreds of path patterns:
.env, SSH and private keys, Terraform state, Docker config, VPN configs, password databases. Datadog counted 290 Linux, 129 macOS and 50 Windows patterns, reading up to 5 MiB per file - Stripe and Slack tokens found by regex in scanned files (Aikido)
Datadog also describes a step that abuses GitHub tokens with workflow scope on up to 100 repositories. It creates a branch named like a Dependabot update, runs a workflow that dumps the repository's secrets, then deletes the run and the branch. The cleanup still leaves audit-log entries, which is how you can find it later.
Root Cause
Stage 0: the maintainer's GitHub identity
Everything started with a GitHub identity that could push to main and run the release workflow. What we know:
- The reporter's conclusion is that "the
jaredwrayaccount, or a credential held by it, is compromised". The maintainer should be treated "as a victim pending their own account of events" (cacheable#1692). - Some commits came through
web-flow, which means GitHub's web UI or API, not a localgit push. - Microsoft: "evidence points towards stolen maintainer credentials".
- Chainguard: the initial access vector is "still unknown". As of writing, there was no public statement from the maintainer, npm or GitHub.
Unknown: whether this was a stolen PAT, a session cookie, an OAuth app grant, or a credential taken by an earlier worm wave. Some secondary sources (for example AVOID.NET) attribute the campaign to TeamPCP. Chainguard says "no named actor has claimed" this wave. SafeDep says the shared "Shai-Hulud" marker with the TanStack compromise "does not establish attribution". This page treats attribution as unconfirmed.
Stage 1: poisoning the source, and letting CI sign it
flowchart TD
A["Compromised jaredwray GitHub identity"] --> B["Commit payload to main<br/>setup.mjs, Math_Symbol.js,<br/>preinstall: node setup.mjs"]
A --> C["Bot-attributed 'verified' commits<br/>add .claude and .vscode hooks<br/>on up to 5 branches"]
B --> D["Push to main triggers<br/>normal release workflow"]
D --> E["GitHub Actions requests OIDC token<br/>(trusted publishing)"]
E --> F["npm publish keyv@6.0.0<br/>with genuine SLSA provenance"]
F --> G["Registry, provenance badge,<br/>npm audit signatures all pass"]
C --> H["Anyone opening the repo in<br/>VS Code or Claude Code"]
H --> I["Hook launches setup.mjs<br/>without any npm install"]
style A fill:#ff6b6b,color:#fff
style F fill:#ff6b6b,color:#fff
style G fill:#cc5500,color:#fff
Some details of how the attacker worked inside the repository are worth studying for detection:
- Test removal. The first payload commit added a test that called the loader. Twenty minutes later another commit deleted only that test and kept the hook. The likely aim was to avoid the payload running visibly in the project's own CI test job before publishing.
- Decoy commits. Of the 18 "chore: update config" commits, 17 changed nothing. They buried the one real change in a noisy history.
- Bot impersonation. Hook commits were attributed to
github-actions[bot]and showed GitHub's "verified" badge. A verified badge only means GitHub signed a commit made through its own UI or API. It says nothing about who was holding the credential. - Tag churn. Datadog saw the
v6.0.0tag deleted four times, and the GitHub Release published about two hours after the npm publish. Release events are not a reliable signal of npm publication. Watch the registry, not GitHub Releases.
Stage 2: install-time execution
The injected package.json change was one line in scripts: "preinstall": "node setup.mjs". preinstall runs before the package's own files are used, and before any test or scanner in your pipeline gets a turn.
setup.mjs is a small loader (Datadog: 11 KB). It looks for a working bun. If there is none, it downloads Bun v1.3.13 from Bun's official GitHub releases without verifying it, into a temp directory prefixed bun-dl-. It then runs a large obfuscated second stage, Math_Symbol.js in the seed packages and math_init.js in worm-generated ones (Aikido: about 728 KB). Two design choices matter for defenders:
- Bun comes from
github.com. Chainguard points out that this means no unusual domain appears in egress logs during staging. Every CI egress allowlist already permits GitHub. - Different behaviour in CI and on laptops. Microsoft and Datadog both say that on workstations the payload detaches, ignores SIGINT/SIGTERM and uses a lock file so only one copy runs. In CI it stays attached to the job so it can read workflow secrets, runner memory and the OIDC token before the job ends.
Stage 3: exfiltration with swappable infrastructure
flowchart LR
S["Stolen data"] --> Z["JSON, gzip,<br/>AES-256-GCM"]
Z --> K["AES key wrapped with<br/>attacker RSA public key"]
K --> P{"Primary channel"}
P -->|"look up C2 domain"| ETH["Ethereum contract read<br/>via public RPC endpoints"]
ETH --> C2["HTTPS POST to /router<br/>npm-cache[.]com and others"]
K --> FB{"Fallback"}
FB -->|"stolen ghp_ or gho_ token"| REPO["New public GitHub repo<br/>'Shai-Hulud: Here We Go Again'"]
The primary C2 domain is not hard-coded. It is read from an Ethereum smart contract through dozens of public RPC endpoints (Datadog counted 73), so the operator can move infrastructure without republishing the payload. Datadog also notes that C2 responses can contain code that the payload evals, which gives the operator arbitrary remote code execution on top of data theft. The fallback commits encrypted results into new public GitHub repositories under the victim's account. SafeDep observes that this route needs no attacker-controlled domain at all.
Domains seen at different times: npm-cache[.]com, pypi-get[.]com, js-mirror[.]com and, from 5 August, awqhnjewqjkl[.]icu (Datadog).
Stage 4: the worm loop
This is the step that turns one compromised maintainer into hundreds of compromised packages. Conceptually:
flowchart TD
T["Valid npm token found<br/>(write access, can bypass 2FA)"] --> L["List every package<br/>this identity can publish"]
L --> D["Fetch latest tarball"]
D --> I["Add loader + payload,<br/>replace lifecycle scripts<br/>with preinstall hook"]
I --> B["Bump patch version"]
B --> P["Publish"]
P --> U["Downstream ^ranges and<br/>fresh installs resolve it"]
U --> X["Payload runs on new<br/>dev machines and CI runners"]
X --> T
O["Token is a GitHub Actions<br/>OIDC trusted publisher"] --> P2["Republished package carries<br/>genuine provenance"]
P2 --> U
style T fill:#ff6b6b,color:#fff
style X fill:#ff6b6b,color:#fff
Three details explain why it spread so fast:
- Patch bumps fall inside caret ranges.
^6.1.23happily resolves6.1.24. Any project without a lockfile, or any CI step that rannpm installornpm updateinstead ofnpm ci, picked up the new version automatically. - It only kept tokens that could publish without a 2FA prompt. Microsoft and Datadog both say it checked tokens for write access and the ability to bypass 2FA. Granular npm tokens created with "bypass 2FA" exist so that CI can publish. Here they were exactly what the worm needed.
- Machine-speed publishing. SafeDep saw eight organisations' packages published at about one per second between 10:12 and 10:46. SafeDep calls automated propagation "an inference" from the identical payload and publishing pace. A human operator was not needed in the loop.
Datadog also describes a narrowly gated path that targets the @opensearch-project/opensearch release workflow to publish with genuine-looking provenance, and the cacheable#1692 reporter added: treat any package that gains an @opensearch/setup optional dependency as compromised.
Stage 5: persistence and the dead-man's switch
Two persistence mechanisms outlive npm uninstall:
- Repository hooks. With a stolen GitHub token, the worm wrote
.claude/settings.json,.claude/setup.mjs,.vscode/tasks.jsonand.vscode/setup.mjsto up to 50 branches per repository (skipping Dependabot and Copilot branches). The Claude Code hook used aSessionStartevent and the VS Code task ran on folder open. Chainguard notes the two cross-reference each other, and that workspace trust blocks both by default. Aikido saw these commits authored asclaudewith the message "chore: update config". gh-token-monitor. A watcher installed under~/.local/bin/~/.config, as a macOS LaunchAgent or a systemd user service, that checks the stolen GitHub token every 60 seconds (SafeDep). Microsoft says it "contains a destructive handler if the monitored token is revoked". SafeDep says this wave's handler is not recovered, and that in the related TanStack wave it wasrm -rf ~/.
Order of operations
Several responders (the cacheable#1692 reporter, SafeDep, Chainguard) say to remove the token monitor before revoking the GitHub token. Revoking first can trigger the handler on the infected host. Chainguard's own TL;DR says to rotate "immediately", which contradicts its later advice. If you can't confirm the host is clean, isolate it from the network, then revoke. A wiped home directory on an isolated machine you were going to rebuild anyway costs much less than a token left live.
Detection
How it was caught
No single scanner "caught" this. Detection came from several directions:
- Human review in the repo. A comment at 09:08 warned against merging six minutes after the first commit, but nothing in the pipeline enforced it.
- Registry-diff scanners. Aikido, Socket and others flag new versions that add install scripts, obfuscated code or a runtime download. A patch release that suddenly gains a
preinstallhook is a strong signal. - Endpoint telemetry. Microsoft's Defender detections (
Trojan:NPM/ShaiLoader.BY,Trojan:NPM/MalBun.A,Trojan:NPM/ShaiWorm.DAY!MTB,Behavior:*/SuspBunActivity.A) key on Node spawning Bun frombun-dl-*folders and then running cloud CLI token commands.
Are you affected? Check lockfiles first
This read-only Node script checks a package-lock.json (v2/v3) against the confirmed seed list. Extend BAD with the full IOC CSV from Datadog's IOC repository or Socket's list for the worm-generated packages.
// check-keyv-worm.mjs: node check-keyv-worm.mjs [path/to/package-lock.json]
import { readFileSync } from "node:fs";
const BAD = {
"keyv": ["6.0.0"],
"flat-cache": ["6.1.24"],
"file-entry-cache": ["11.1.6"],
"cacheable-request": ["13.0.20"],
"cacheable": ["2.5.1"],
"@cacheable/memory": ["2.2.1"],
"@cacheable/utils": ["2.5.1"],
"@cacheable/node-cache": ["3.1.2"],
"@cacheable/net": ["2.1.1"],
"cache-manager": ["7.2.10"],
"ecto": ["5.0.1"],
};
const lock = JSON.parse(readFileSync(process.argv[2] ?? "package-lock.json", "utf8"));
let hits = 0;
for (const [path, meta] of Object.entries(lock.packages ?? {})) {
const name = meta.name ?? path.split("node_modules/").pop();
if (BAD[name]?.includes(meta.version)) {
console.log(`AFFECTED: ${name}@${meta.version} at ${path || "(root)"}`);
hits++;
}
if (meta.hasInstallScript) console.log(`install script: ${path}`);
}
process.exitCode = hits ? 1 : 0;
hasInstallScript is printed for every package. Diff that list between yesterday's and today's lockfile. A dependency that newly gains an install script in a patch release is the pattern this worm (and Shai-Hulud before it) creates.
Host and repository indicators
# Payload files inside node_modules (seed and worm-generated names)
find . -path '*/node_modules/*' \( -name 'setup.mjs' -o -name 'Math_Symbol.js' \
-o -name 'math_init.js' -o -name 'Math_*.js' \) 2>/dev/null
# Bun staging directories left by the loader
ls -d /tmp/bun-dl-* "${TMPDIR:-/tmp}"/bun-dl-* 2>/dev/null
# Token-monitor persistence (inspect, do NOT revoke tokens yet)
ls ~/.local/bin ~/.config 2>/dev/null | grep -i 'gh-token-monitor'
ls ~/Library/LaunchAgents 2>/dev/null | grep -i token
systemctl --user list-unit-files 2>/dev/null | grep -i token
# IDE auto-run hooks in your checkouts. Review before opening in an editor
git log --all --oneline -- .claude/settings.json .claude/setup.mjs \
.vscode/tasks.json .vscode/setup.mjs
# Dead-drop repos created under your org's accounts
gh search repos --match description "Shai-Hulud: Here We Go Again" --owner YOUR_ORG
Hashes published by Microsoft and Aikido (SHA-256):
| File | SHA-256 |
|---|---|
setup.mjs (npm tarball loader) | 54dc7ea54a1317cca0e890a2770630cf7fa6c97813e0cb9d2caa93012b350668 |
setup.mjs (repo-hook / community-spread loader) | fd3ca4007b225fdf8de7af4345a19179d5efa8c4bb9205f88cda806e5684b1eb |
Math_Symbol.js / math_init.js | 9fc2570b7cef51c1b8df116d144d11ff4096357be7d2c4c6367cfc2509cf1bcc |
Chainguard recommends relying on file paths over hashes because the published hashes were still being reconciled. The payload was regenerated per wave.
Network and audit-log signals
- DNS or HTTPS to
npm-cache[.]com,pypi-get[.]com,js-mirror[.]com,awqhnjewqjkl[.]icu. - Ethereum JSON-RPC traffic from build machines (for example
eth-mainnet.nodereal[.]io,go.getblock[.]io,eth.llamarpc[.]comper CSA). A CI runner has almost no legitimate reason to call an Ethereum node. - In GitHub audit logs: new public repositories, workflow runs on short-lived
dependabot/github_actions/...branches that you didn't create,workflow_rundeletions, and branch pushes that add.claude/or.vscode/files. - In npm: publishes of your packages that have no matching commit, tag or release. Microsoft notes many worm versions had none, which points to tarballs modified and published directly.
Response and Remediation
What the maintainer did
On 5 August the maintainer posted a remediation summary on cacheable#1692:
- Disabled all workflows and npm trusted publishing.
- Wiped and rebuilt every possibly affected machine.
- Force-reset
mainfrom the malicious commit to its clean parent. - Deleted the malicious
setup-files-v1tag. - Re-audited the repository and found no remaining payload files or hooks.
- Kept publishing disabled until GitHub cleanup and account review were finished. Keyv remediation is tracked separately in keyv#2051.
npm removed the poisoned cacheable releases and restored the previous versions as latest. The maintainer asked GitHub Support to purge the malicious commit, its release archives, Actions artifacts and cached references. That step matters because force-pushing does not delete a commit from GitHub. It stays reachable by hash until GitHub garbage-collects or purges it.
Chainguard warns that pinning to a clean version is only "a point-in-time fix": the payload had been staged across all 19 @keyv/* workspace packages, so a legitimate release cut from a dirty tree would have shipped it again.
What consumers should do
Synthesised from CSA AD-2026-009, cacheable#1692, SafeDep, Chainguard and Microsoft:
- Scope. Search lockfiles, artifact repositories, container images and shared CI caches for the affected versions, including transitive ones.
- Contain. Isolate affected hosts. Block the C2 domains and Ethereum RPC endpoints at egress.
- Remove persistence first. Unload and delete
gh-token-monitor(LaunchAgent / systemd user unit, and on Linuxloginctl disable-lingerper SafeDep), and remove.claude/.vscodehooks from every branch. - Rotate from a clean host. npm, GitHub (PATs, OAuth, app installations), cloud, Kubernetes, Vault, database and SSH credentials. Chainguard suggests rotating npm and GitHub first because they drive propagation.
- Rebuild, don't clean. Rebuild workstations, runners, golden images and base images from a known-good dependency baseline.
- Purge caches.
npm cache clean --force, the pnpm store, the Yarn cache, and CI cache keys that may hold poisoned tarballs. - Audit what credentials could reach. Check cloud and SCM logs for activity after the install time: unexpected npm publishes, new repos, workflow runs, Secrets Manager reads.
- Treat IDE-opened checkouts as executed. Any repo that was opened in VS Code or a coding agent while it contained the hooks counts as a possible execution.
What Would Have Prevented It
No single control stops a worm that starts with a legitimate maintainer identity. The controls below each break a different link in the chain.
flowchart LR
subgraph Maintainer["Maintainer side"]
M1["Phishing-resistant 2FA,<br/>short-lived credentials"]
M2["Branch rulesets:<br/>no direct push to main"]
M3["Release environment<br/>with required reviewer"]
M4["No 2FA-bypass tokens,<br/>trusted publishing only"]
end
subgraph Consumer["Consumer side"]
C1["Lockfile + npm ci"]
C2["Install scripts blocked<br/>by default"]
C3["Release-age cooldown"]
C4["Egress allowlist +<br/>secret isolation in CI"]
C5["Workspace trust,<br/>no auto tasks"]
end
M2 --> Stop1["Stops payload reaching main"]
M3 --> Stop2["Stops silent CI publish"]
M4 --> Stop3["Stops worm republishing"]
C1 --> Stop4["Stops auto-upgrade to bad patch"]
C2 --> Stop5["Stops preinstall execution"]
C3 --> Stop6["Waits out the detection window"]
C4 --> Stop7["Limits what a payload can steal"]
C5 --> Stop8["Stops checkout-time execution"]
1. Consumers: lockfiles and npm ci, always
Every poisoned version was a patch bump. A committed lockfile with npm ci installs exactly the locked version and integrity hash, so a new 6.1.24 is never resolved by accident.
# CI: reproducible, refuses to change the lockfile, no lifecycle scripts
npm ci --ignore-scripts
# then run only the scripts you need, explicitly
npm rebuild esbuild sharp # example: packages you have reviewed
Note the caveat from the npm v12 coverage: an older ignore-scripts=true in .npmrc overrides v12's allowScripts list silently. Pick one mechanism and test it.
2. Consumers: block install scripts by default
npm v12 (GA 8 July 2026) skips dependency preinstall/install/postinstall scripts unless approved, with a warning, and offers strict-allow-scripts to make it a hard error for CI (Socket, GitHub discussion #198547). keyv had no install script before 6.0.0, so a project that had approved its existing scripts on npm v12 would not have had keyv's new preinstall on its allowlist. That is our inference, not a measured result. Chainguard recommends npm 12+ for this reason.
# npm 12: review which dependencies want to run scripts, approve explicitly
npm approve-scripts --allow-scripts-pending
# fail CI hard instead of warning when an unapproved script appears
npm config set strict-allow-scripts true --location=project
pnpm has blocked dependency build scripts by default since v10. Approve the few that need them:
# pnpm-workspace.yaml
onlyBuiltDependencies:
- esbuild
- sharp
# everything else: install scripts never run
Yarn Berry and Bun have equivalents (enableScripts: false in .yarnrc.yml, and Bun's trustedDependencies allowlist in package.json). See pnpm vs npm vs Yarn.
Install-script blocking was not enough here
This payload also spread through .claude/settings.json and .vscode/tasks.json hooks committed into repositories. Those run when a developer opens the repo, with no install at all. Blocking scripts closes the npm path, not the IDE path. See control 6.
3. Consumers: a release-age cooldown
The worm's publishes ran from 09:35 to 13:18 UTC, and the first public analyses came out the same day. A cooldown of even 24 hours would have kept every poisoned version out of fresh resolutions. Microsoft's mitigation list explicitly recommends npm's min-release-age, and Chainguard credits cooldowns (plus scanning) for keeping its customers unaffected.
# .npmrc: npm skips versions published less than N days ago
min-release-age=3
# pnpm-workspace.yaml: minutes. 4320 = 3 days. Also applies to transitive deps
minimumReleaseAge: 4320
minimumReleaseAgeExclude:
- "@your-org/*" # your own packages can skip the cooldown
For urgent security patches, override on purpose, for example npm install --min-release-age=0 pkg@x.y.z, and record why. A cooldown gives up a few days of freshness in return for letting registry scanners and other people's incident responders act first.
4. Maintainers: protect the branch, not just the token
The attacker never needed an npm token for the seed packages. They pushed to main, and CI published. Treat "can push to the default branch" as equivalent to "can publish to npm".
- Repository or organisation rulesets on
main: require a pull request, at least one approving review from someone other than the pusher, passing status checks, and block force pushes and deletions. Apply them to administrators too. A solo maintainer can use a second account or a trusted co-maintainer as reviewer. - CODEOWNERS for high-risk paths, so changes to them always need explicit review:
# .github/CODEOWNERS
/.github/workflows/ @your-org/release-owners
/.claude/ @your-org/release-owners
/.vscode/ @your-org/release-owners
package.json @your-org/release-owners
- Phishing-resistant 2FA (passkeys / security keys) on GitHub and npm, short PAT lifetimes, fine-grained PATs scoped to single repositories, and regular review of authorised OAuth apps and SSH keys. This does not fix the unknown vector, but it removes the most common ones.
5. Maintainers: gate the publish job behind a human
Trusted publishing removed the long-lived npm token, but the attacker controlled the code that the trusted workflow built. Put a required reviewer between "code is on main" and "package is on npm".
# .github/workflows/release.yml (sketch)
on:
push:
tags: ["v*"]
permissions: {} # nothing by default
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@<full-commit-sha>
with:
persist-credentials: false
- uses: actions/setup-node@<full-commit-sha>
with:
node-version: 24
- run: npm ci --ignore-scripts
- run: npm test
- run: npm pack
- uses: actions/upload-artifact@<full-commit-sha>
with:
name: tarball
path: "*.tgz"
publish:
needs: build
runs-on: ubuntu-latest
environment: npm-release # configure: required reviewers, tag-only deployment
permissions:
contents: read
id-token: write # OIDC for npm trusted publishing, only in this job
steps:
- uses: actions/download-artifact@<full-commit-sha>
with:
name: tarball
- uses: actions/setup-node@<full-commit-sha>
with:
node-version: 24
registry-url: https://registry.npmjs.org
- run: npm publish ./*.tgz --access public
Then, in the npm package settings:
- Configure the trusted publisher with the workflow file name and the environment name (
npm-release), so OIDC tokens from any other workflow or job are rejected. - Set publishing access to "Require two-factor authentication and disallow tokens", and revoke old automation tokens. Adding a trusted publisher does nothing to an existing
NPM_TOKENby itself. - Consider staged publishing, where a CI publish goes public only after a maintainer approves it with 2FA. The Socket write-up says GitHub recommends trusted publishing or staged publishing with human approval as tokens with 2FA bypass are phased out.
Why "disallow tokens" breaks the worm loop
The worm's propagation step needs an npm credential that can publish without an interactive 2FA prompt. If every package you maintain disallows token publishing, a token stolen from your laptop can't republish them, and the chain stops at you. According to Socket's npm v12 write-up, npm planned to limit sensitive account actions by 2FA-bypass tokens from early August 2026 and to remove their direct publishing around January 2027. Check the npm changelog for the current status.
6. Everyone: don't let a checkout execute code
VS Code workspace trust and Claude Code's own trust prompt block both hooks by default (Chainguard). Keep it that way, and turn off automatic tasks:
// VS Code user settings.json
{
"security.workspace.trust.enabled": true,
"security.workspace.trust.untrustedFiles": "prompt",
"task.allowAutomaticTasks": "off"
}
Review diffs to .vscode/, .claude/, .cursor/ and similar agent configuration as you would CI workflows. They are executable configuration. A pre-receive check or required status check that fails any PR touching them without a CODEOWNERS approval is cheap.
7. CI: egress control and secret isolation
The payload targeted CI runners specifically: runner memory, the OIDC token, every environment variable. Two controls limit what it gets:
- Run installs in a job with no secrets and no
id-token: write, as in the workflow above. Dependencies are installed and tested inbuild. Only the reviewed tarball reachespublish. - Default-deny egress on runners, for example with StepSecurity Harden-Runner:
- uses: step-security/harden-runner@<full-commit-sha>
with:
egress-policy: block
allowed-endpoints: >
registry.npmjs.org:443
github.com:443
api.github.com:443
objects.githubusercontent.com:443
Be honest about the limit: this payload downloaded Bun from GitHub and could exfiltrate to GitHub repositories, and both destinations are on every allowlist. Egress control would have blocked the primary Ethereum-resolved C2 and the RPC lookups, not the GitHub fallback. Pair it with short-lived, narrowly scoped tokens: a GITHUB_TOKEN with contents: read can't create repositories or push hook commits to other repos.
8. Verify provenance, but don't stop there
npm audit signatures and provenance checks are still worth running. They catch a package published from a stolen token outside CI, which was the case for many worm-generated versions. They can't catch a poisoned source repository. Datadog sums it up: a valid attestation is "neither forged nor a safety verdict". Combine it with diff-based review of what changed between versions: new install scripts, new files, new runtime downloads, obfuscation.
Lessons for System Design
- Trust boundaries are identities, not systems. The npm registry, the GitHub repository, the CI runner and the IDE were all working correctly. The attack moved through identities (a maintainer account, then every token it could find). Model your supply chain as a graph of identities and the actions each can take, then cut the edges where one identity can act without a second party.
- Attestation is not authorisation. SLSA provenance answers "which pipeline built this from which commit?" It doesn't answer "should this commit have been built?" Systems that turn provenance into an allow decision need a separate gate: review, approval or policy on the source.
- Self-propagation needs fan-out credentials. The worm spread because single tokens could publish many packages without a human in the loop. Narrow credentials (one package, one workflow, one environment, short TTL) turn a worm into a single-package incident. The same blast-radius idea applies to cell architectures, and to least privilege generally.
- Defaults decide outcomes. npm v12's script-off default, pnpm's build allowlist and workspace trust all existed and would each have broken a path. The machines that were hit were the ones running older defaults. When you ship a platform, make the safe behaviour the default and the unsafe one an explicit, auditable opt-in.
- Incident response must model adversarial persistence. A watcher that destroys data when a credential is revoked reverses the usual playbook. Response runbooks need a "contain and remove persistence, then rotate" branch, and practice. See the incident response playbook.
- Delete is not delete. Force-pushing history, deleting tags and unpublishing versions leave copies in forks, caches, mirrors and Git object stores. Recovery has to include purging those caches (CI caches, artifact proxies, GitHub cached commits), or the poison can come back.
- Monitor what you publish, not only what you consume. A maintainer-side alert of "a version of my package was published with no matching tag", or "a release added an install script", would have fired within minutes. Registries and SCM platforms expose the events to build this.
What Would You Do?
Scenario 1: At 10:30 UTC on 4 August your CI shows `flat-cache@6.1.24` was installed in 40 builds over the last hour. Do you (A) revoke the CI's npm and GitHub tokens right away, (B) bump to a clean version and re-run builds, or (C) isolate the runners, check for persistence, then rotate?
(C). Option (B) leaves stolen credentials live, and the payload may already have republished your packages. Option (A) is the right instinct, but if any of those runners is persistent (self-hosted, a reused VM or a developer laptop) the token watcher may run a destructive handler on revocation. Ephemeral GitHub-hosted runners are already gone, so for those, rotate at once. For persistent hosts, isolate first, remove the watcher, then rotate. In both cases, also check npm for versions of your packages that you didn't publish.
Scenario 2: You maintain a popular library that uses npm trusted publishing with valid provenance. A colleague says "we're safe from this class of attack because we don't have an npm token." Are they right?
No. keyv used trusted publishing too. The attacker pushed to main, and the trusted workflow published a malicious build with genuine provenance. Trusted publishing removes one credential, the long-lived npm token. It doesn't protect the branch or the build inputs. You also need branch rulesets that block direct pushes, CODEOWNERS on workflows and package.json, and a protected deployment environment with a required reviewer that the trusted publisher config is bound to.
Scenario 3: A developer cloned an affected repository and opened it in VS Code but never ran `npm install`. Are they exposed?
Possibly. The worm committed .vscode/tasks.json (folder-open task) and .claude/settings.json (session-start hook) to many branches. If the developer trusted the workspace, or automatic tasks were enabled, the loader could run with no install. Treat the machine as possibly executed: check for bun-dl-* directories, the token watcher and unexpected processes, and investigate before trusting its credentials.
Key Lessons
- Provenance is not a safety verdict. A compromised source repo plus an honest CI gives you a signed, malicious package.
- Block install scripts and add a cooldown. npm v12 / pnpm script allowlists and
min-release-age/minimumReleaseAgewould each have stopped fresh installs that day. - Disallow token publishing on your packages. The worm needed 2FA-bypass tokens to spread.
- Repositories can execute code on open. Review
.vscode/and.claude/like workflows, and keep workspace trust on. - Remove persistence before you rotate. The token watcher punishes the obvious first move.
Quiz
Q1: Why did keyv@6.0.0 pass provenance checks?
It really was built and published by keyv's own GitHub Actions workflow through npm trusted publishing. The attacker had pushed the payload to the source repository, so the pipeline honestly attested a malicious build.
Q2: Name the two execution triggers this worm used.
The npm preinstall lifecycle script (node setup.mjs) at install time, and IDE auto-run hooks (.vscode/tasks.json folder-open task and .claude/settings.json SessionStart hook) committed into repositories, which run when the checkout is opened.
Q3: Why were patch bumps an effective way to spread?
Caret ranges such as ^6.1.23 accept any newer patch, so projects without a lockfile, or CI that ran npm install instead of npm ci, picked up the poisoned version automatically.
Q4: Why should you remove persistence before revoking the stolen GitHub token?
The gh-token-monitor component polls the token and runs a handler when it is revoked. Microsoft calls it destructive, and in the related TanStack wave it deleted the home directory. Removing it first, or isolating the host, avoids triggering it.
Q5: Would a strict egress allowlist on CI runners have stopped exfiltration? Partly. It would block the Ethereum RPC lookups and the primary C2 domains. But the loader downloaded Bun from GitHub and the fallback exfiltrated to public GitHub repos, and both use domains that almost every CI allowlist permits. Narrow token scopes are the complementary control.
Related Pages
- TanStack npm Supply Chain Compromise (May 2026): an earlier wave that used the same "Shai-Hulud" marker and also produced validly-provenanced malicious packages
- Axios Supply Chain Attack (March 2026): a stolen classic npm token and a
postinstallRAT dropper - LiteLLM Supply Chain Attack (March 2026): CI secret theft leading to a poisoned PyPI release
- XZ Utils Backdoor (2024): a compromised maintainer identity, over a much longer timescale
- SolarWinds: a trusted build pipeline signing malicious code
- Software Supply Chain Security: SLSA, SBOMs, Sigstore and provenance
- Secrets in CI/CD and Secret Rotation Automation
- GitHub Actions Deep Dive and CI Security Scanning
- pnpm vs npm vs Yarn
- Bun Runtime
- Incident Response and Forensics
One-Liner Summary
One hijacked maintainer identity pushed a payload to main, the project's own trusted pipeline signed and published it, and a preinstall-hook worm then used every npm token it stole to republish hundreds of other packages. Lockfiles, script allowlists, release cooldowns and a human approval gate on publishing would each have broken the chain.
Sources
Primary and researcher write-ups
- Microsoft Security Blog: ChainDrop supply chain compromise: Anatomy of a self-propagating worm (4 Aug 2026). Payload, propagation, persistence, IOCs, Defender detections, hunting queries
- Datadog Security Labs: 'ChainDrop' worm compromises hundreds of popular npm packages (4 Aug, updated 5 Aug 2026). Commit-level timeline, run IDs, payload internals, IOCs
- Aikido: Keyv and friends compromised in npm supply chain attack (4 Aug, updated 5 Aug 2026). Package list, 444 packages / 1,381 versions, hashes
- GitHub: jaredwray/cacheable#1692: Supply-chain compromise across jaredwray/keyv + jaredwray/cacheable. Reporter timeline, last-clean versions, maintainer remediation summary (5 Aug 2026)
- Cyber Security Agency of Singapore: AD-2026-009: Ongoing npm Supply Chain Attack Affecting Keyv and Related Packages (6 Aug 2026)
- SafeDep: keyv and cacheable npm compromise: 400+ packages. 2,234 versions / 12 organisations, token-watcher behaviour
- Chainguard: The keyv and cacheable npm supply chain attack: inside the Mini Shai-Hulud campaign. Provenance analysis, IDE hooks, remediation order
Platform changes referenced
- Socket: npm v12 ships with install scripts off by default, begins deprecating 2FA-bypass tokens (8 Jul 2026)
- GitHub Community: Preparing for npm v12: install scripts and non-registry sources become opt-in (#198547)
Disputed or unverified on this page
- Initial access vector for the maintainer account: unknown. No maintainer, GitHub or npm statement as of 2026-11-09.
- Attribution to TeamPCP: unconfirmed. Asserted by some secondary sources, not by Microsoft, Datadog, Chainguard or SafeDep.
- Total versions: 1,381 (Aikido) vs 2,234 (SafeDep) vs "more than 1,300" (CSA).
- Number of machines that actually executed the payload: not published.
- The token-watcher handler in this wave: "destructive" per Microsoft, "unknown" per SafeDep.