ChainDrop and Shai-Hulud: When a Trusted npm Package Turns Into a Worm
A plain account of the ChainDrop worm that hit keyv in August and Tensorlake in October 2026, and what to do about it.
On August 4, 2026, malicious versions of keyv, flat-cache and several related packages were published to npm. They stole credentials from every machine that installed them and used those credentials to publish themselves into more packages. Researchers named this variant ChainDrop and tied it to the Shai-Hulud worm family. On October 8 the same code appeared in the Tensorlake SDK. This post summarises public reporting on both incidents and what they mean for an ordinary Node.js project. Sources are linked at the end.
What Happened in August
According to the vendor write-ups, attackers took over the GitHub account of a maintainer behind a family of caching utilities. They did not need a stolen npm token. They pushed malicious files to the project branches and let the projects' own GitHub Actions release workflows publish them.
Malicious versions named in the reporting include:
keyv 6.0.0 (clean: 5.6.0)
flat-cache 6.1.24 (clean: 6.1.23)
cache-manager 7.2.10 (clean: 7.2.9)
file-entry-cache 11.1.6
cacheable 2.5.1
cacheable-request 13.0.20They were live for roughly one to two hours from about 09:35 UTC. That sounds short, but flat-cache and file-entry-cache sit underneath ESLint, so a very large number of projects pull them in without ever naming them. A single npm install in that window was enough.
Counts differ by vendor because the worm kept republishing: Socket counted 2,251 poisoned versions across 452 packages, and Elastic reported more than 400 unique packages.
How the Worm Works
The reporting describes a loop with three steps:
- Run on install. The package gains a
preinstallscript, which npm runs before the install finishes. - Steal credentials. The script collects npm tokens, GitHub tokens, cloud keys and CI/CD secrets from the machine. Stolen data was sent to an attacker domain, and some was published to new GitHub repositories created under the victim's account with the description "Shai-Hulud: Here We Go Again".
- Spread. With a stolen npm token, it lists every package that identity can publish, downloads each one, inserts itself, bumps the patch version and republishes.
Step three is what makes it a worm. Each new victim who maintains packages becomes a new source of infected releases, with no further work from the attacker.
October: Tensorlake
On October 8, 2026, version 0.5.144 of the Tensorlake npm SDK was published with the same family of code. Socket reported flagging it about 11 minutes after publication. npm removed the version and the project released 0.5.145.
The method matched August: a malicious commit landed on the main branch under a maintainer identity, and the repository's release workflow published it a day later. Coverage noted the shift in target, from general-purpose utilities to an SDK used in AI agent infrastructure, where build machines tend to hold valuable API keys.
Why Provenance Did Not Catch It
npm provenance attests that a package was built by a specific workflow in a specific repository. The malicious keyv@6.0.0 carried valid provenance, because it really was built by the project's workflow from the project's repository. The repository itself had been tampered with.
Provenance answers "did this come from where it claims?" It does not answer "was the person who pushed the commit the real maintainer?" or "is the code safe?" It is still useful, since it rules out uploads from a stolen token on a random laptop, but a green provenance badge is not a safety check.
Did npm 12 Fix This?
Partly. npm 12, released on July 8, 2026, stops running dependency install scripts by default, which blocks the preinstall trigger this worm used. Two limits are worth knowing:
- It only helps where npm 12 is actually in use. Older npm versions, pinned CI images and other package managers with scripts enabled still run them.
- Malware does not have to use install scripts. The PolinRider loader found in November runs when the package is imported, which no install-time setting prevents.
Check what your pipeline really runs:
npm --version
npm config get ignore-scriptsHow to Check Whether You Were Affected
Search lockfiles for the bad versions. Direct dependencies are not enough, because these packages are almost always transitive.
npm ls keyv flat-cache file-entry-cache cacheable cacheable-request cache-manager tensorlake
grep -nE '"(keyv|flat-cache|cache-manager)"|keyv@6\.0\.0|flat-cache@6\.1\.24' \
package-lock.json yarn.lock pnpm-lock.yaml 2>/dev/nullThen look at the evidence the worm leaves behind:
- New repositories on your GitHub account or organisation that you did not create, especially with the description above.
- npm packages you maintain with a patch release you did not publish.
- CI logs from August 4 and October 8 showing an install of one of the listed versions.
- Outbound requests from build machines to hosts listed in the vendor advisories.
StepSecurity published a script that checks lockfiles against the full list of compromised versions, which is longer than the table here.
If You Installed a Bad Version
- Assume every credential on that machine or CI runner was taken. Rotate npm, GitHub and cloud credentials, and any secrets exposed to the workflow.
- Revoke tokens rather than only creating new ones. A stolen token works until it is revoked.
- Pin to the clean versions, delete
node_modules, clear the npm cache and reinstall. - Audit what your accounts published and pushed since the install.
Reducing the Blast Radius
- Install from the lockfile.
npm ciinstalls exactly what is recorded. A freshnpm installwith caret ranges is what pulls in a release that is an hour old. - Add a cooldown. Tools such as Renovate and pnpm can refuse versions younger than a set number of days. Both incidents were detected within hours.
- Give CI the least it needs. A job that only runs tests does not need a publish token or cloud admin keys. Scope secrets to the jobs that use them.
- Use short-lived publish credentials. npm trusted publishing with OIDC removes the long-lived token a worm wants to steal. npm is also phasing out tokens that bypass two-factor authentication.
- Protect the release path. Require review on the default branch and on workflow files, and require approval before a release job runs. In both incidents the release workflow published whatever landed on the branch.
- Secure maintainer accounts. Both compromises started with a GitHub account, not with npm. Use phishing-resistant two-factor authentication such as passkeys or hardware keys.
None of this needs a security team. A committed lockfile, npm ci, a short cooldown and narrowly scoped CI secrets would have kept most projects out of both incidents. For handling the secrets themselves, see environment variable best practices.
Sources
Written by Kashyap Thakar
Spotted a mistake? Let me know
Try these tools
Use these tools alongside this guide