The Tensorlake npm Compromise Targeted Your AI Tool Configs
A compromised npm release went after cloud credentials as expected, and local AI coding-assistant config files, which most teams never treated as secrets.
Key takeaways
- The malicious tensorlake 0.5.144 npm release ran a credential-stealing worm from a preinstall hook, and its target list included config and MCP files for Claude, Cursor, Kiro, Windsurf and Zed.
- Block install scripts by default, treat AI tool configs as secrets, and remove the worm's persistence before rotating everything the machine could reach.
On this page
tensorlake 0.5.144, published October 8, 2026, ran a credential-stealing worm from a preinstall hook, so npm install alone was enough. Besides cloud, GitHub and npm tokens, it went after configuration and MCP files for AI coding tools. If you installed it, isolate the machine, remove the persistence, then rotate everything it could reach, AI tool sessions included.
Verified against
npm CLI 12.2.1 and 11.21.1, against the npm CLI docs and Socket's tensorlake 0.5.144 analysis. Checked October 2026.
What actually happened
Socket reports the malicious version was published at 01:12:07 UTC on October 8, 2026 and flagged at 01:23:10 UTC, about 11 minutes later; it was pulled and replaced. The release added a preinstall hook running node lib/setup.mjs, a loader that launched the payload in lib/Math_Symbol.js with Bun. Because preinstall hooks execute automatically on install, nobody had to import the SDK or start an agent. Socket ties it to the same ChainDrop / Shai-Hulud family as the August compromises of keyv, cacheable and related packages, matching loader and payload filenames and the same Ethereum-based endpoint resolver. The package sees about 12,000 weekly downloads by Socket's count, which describes overall usage, not confirmed infections, but gives a sense of the blast radius if detection had taken hours.
The worm behavior matters as much as the theft: it enumerates packages tied to the victim's npm publishing identity, generates provenance, and republishes compromised versions. One infected maintainer laptop becomes the next poisoned release.
Why the target list matters more than the mechanism
Every npm supply-chain post for the last several years has told you to worry about cloud provider credentials and CI tokens. That's still correct: Socket lists npm tokens, GitHub tokens, AWS credentials from IMDS, Secrets Manager and SSM, local HashiCorp Vault, Kubernetes service-account tokens and kubeconfigs, SSH keys and .env files. What's new is the explicit reach for AI development tools: configuration and MCP files associated with .claude, .cursor, .kiro, Windsurf and Zed. Those files can hold API keys, authenticated sessions, and MCP server configs with their own embedded tokens. Most teams don't rotate them, don't scope them, and often don't know where they live on disk. A worm that treats them as another secret to exfiltrate means your threat model needs an update, not a one-off incident response.
The install-script problem has a default fix now
npm has run package install scripts automatically for as long as most of us have used it, and "just disable install scripts" was advice teams ignored because legitimate packages (native bindings, browser downloads) need them. npm 12 changes the default. Its approve-scripts documentation says "Dependency install scripts are blocked by default": install commands skip lifecycle scripts for any dependency without a matching entry in the allowScripts field of package.json. As of October 2026, npm 12.2.1 is the latest release.
$ npm --version
12.2.1
$ npm approve-scripts --allow-scripts-pending
$ npm approve-scripts better-sqlite3 node-pty
The first command lists packages whose scripts are waiting for a decision; the second records version-pinned approvals in package.json, so a new version of an approved package needs approval again. By default an unapproved script is skipped with a warning; set strict-allow-scripts to make it a hard failure in CI:
# .npmrc
strict-allow-scripts=true
On npm 11, recent 11.x releases record allowScripts approvals but still run install scripts by default and only print a list of unreviewed packages. Until you upgrade, turn scripts off in CI and rebuild only what you have reviewed:
# .github/workflows/ci.yml
- name: Install dependencies without executing scripts
run: npm ci --ignore-scripts
- name: Rebuild only vetted native dependencies
run: npm rebuild better-sqlite3 node-pty
Two caveats. --ignore-scripts overrides both allow-scripts and dangerously-allow-all-scripts, so don't combine them and expect the allowlist to apply. And none of this protects a developer who runs an older npm, or Bun or pnpm with their own policies, on a laptop full of credentials. Upgrade the tooling on machines, not just in CI. Our npm supply-chain CI hardening guide covers lockfile and provenance checks on the pipeline side.
Treat AI tool config files like credentials, because they are
Most teams have a secrets inventory for cloud keys, database passwords, and API tokens. Almost none list "the local session file my editor's AI assistant uses to stay authenticated", and this incident argues for adding it. A quick inventory on developer machines:
$ for path in "$HOME/.claude" "$HOME/.claude.json" "$HOME/.cursor" \
"$HOME/.kiro" "$HOME/.config/zed"; do
[ -e "$path" ] && echo "FOUND: $path"
done
These are candidate paths for the tools Socket named; adjust for your OS and the assistants your team uses. The goal isn't to delete these files. It's to know they exist, know what they grant access to (including every MCP server token inside them), and include them explicitly in the runbook for "a dependency may have run arbitrary code on this machine."
Rotation after a worm: remove persistence first, then rotate broadly
The instinct after a compromised install is to rotate the npm token and move on. That's the wrong scope for a worm built to harvest whatever it can reach, and with this payload it's also the wrong order. Socket documents a "hostage token" monitor that polls GitHub with the stolen token and runs an attacker-supplied handler if that token is revoked, with a warning that revoking while the monitor runs triggers wipe behavior. So:
- Isolate the host. Check lockfiles, build logs and artifacts for
tensorlake@0.5.144. - Remove persistence: the
gh-token-monitoruser service and~/.config/gh-token-monitor/on Linux, thecom.user.gh-token-monitorLaunchAgent on macOS, theONLOGONscheduled task runningmonitor.ps1on Windows. - Rotate everything the machine could reach: cloud credentials, Git and CI tokens, npm tokens, SSH keys, Vault and Kubernetes credentials, and AI tool sessions and MCP tokens.
- Audit for unexpected package publishes and new GitHub Actions workflows, since the worm republishes packages and may plant workflows.
Scoping the rotation to "the thing that seems related" is how a second incident starts three weeks later from a token nobody thought to touch.
The decision, concretely
- Are your CI pipelines on npm 12 with
strict-allow-scripts, or on an older npm with--ignore-scripts? If neither, every transitive dependency can run code on install. - Do you know where your team's AI coding assistants store local config, sessions and MCP tokens? If not, that's the gap this incident exposes, not the specific package name.
- Does your runbook remove persistence before rotating, and rotate everything reachable from the machine? Write it down before you need it.
- Do you learn about registry compromises from an alerting feed or from the news? An 11-minute detection only helps if you hear about it before your next install.
Questions people ask
What did the tensorlake 0.5.144 malware steal?
Socket's analysis lists npm tokens, GitHub tokens, AWS credentials (IMDS, ECS, Secrets Manager, SSM), local HashiCorp Vault, Kubernetes service-account tokens and kubeconfigs, SSH keys, .env files, crypto wallets, messaging app data, and configuration and MCP files for Claude, Cursor, Kiro, Windsurf and Zed. Treat every credential present on a machine or runner where the install scripts ran as exposed.
Does npm block install scripts by default?
npm 12 does. Its approve-scripts docs say dependency install scripts are blocked by default, and only dependencies listed in the allowScripts field of package.json may run them. Unapproved scripts are skipped with a warning, or fail the install with strict-allow-scripts=true. On npm 11, install scripts still run by default with a warning about unreviewed packages, so pass --ignore-scripts there.
Should I revoke my GitHub token immediately after a Shai-Hulud infection?
Not before removing persistence. Socket reports this payload installs a monitor that polls GitHub with the stolen token and runs an attacker-supplied handler, including wipe behavior, when the token is revoked. Isolate the host, remove the gh-token-monitor service, LaunchAgent or scheduled task, then revoke and rotate all credentials.
The call we'd make
Get CI and developer machines onto npm 12 with strict-allow-scripts, or --ignore-scripts where you can't upgrade yet, and treat every script approval as a reviewed decision. Separately, find out where your team's AI coding tools store credentials, sessions and MCP tokens, because this payload went after exactly that and most security checklists still don't mention it. Software supply-chain attacks covers the broader pattern this fits into, and our AI agent security piece is the place to start on treating AI tool configuration as the credential it is.
Sources
Cite this article
Kiril Urbonas (2026). The Tensorlake npm Compromise Targeted Your AI Tool Configs. DevOpsNess. Updated 2026-10-31. https://www.devopsness.com/blog/tensorlake-npm-shai-hulud-ai-agent-worm
[The Tensorlake npm Compromise Targeted Your AI Tool Configs](https://www.devopsness.com/blog/tensorlake-npm-shai-hulud-ai-agent-worm) (Kiril Urbonas, DevOpsNess, updated 2026-10-31)
More from DevOps
Explore more articles in this category
kaniko CVE-2026-105769: Lookalike ACR Hosts Get Your Azure Token. Rebuild on v1.25.20
A FROM line pointing at a host like x.azurecr.io.attacker.com is enough to make kaniko hand the build's Entra ID token to that host. Which kaniko forks and images are affected, how to find Azure identities in your build pods, and what to rotate.
Sign Container Images With Cosign: Keyless GitHub Actions Workflow, SBOM and In-Cluster Checks
One workflow that builds, signs keylessly with GitHub OIDC, attaches an SBOM and SLSA provenance, plus the Kyverno policy that refuses anything unsigned. Copy it, change three names, ship it.
GitLab CVE-2026-110264: A Second CVSS 10 RCE in Nine Days. Patch to 19.5.1
An unauthenticated regex-compiler RCE reaching back to GitLab 7.0, no workaround, and backports on older branches that fix only the critical bug. The exact version per branch and the commands to get there.
You might have missed
Evergreen posts worth revisiting.