If a compromised npm package may have reached your builds, work in this order: find the exact name@version in every lockfile, cache and CI log; work out whether its code actually ran; isolate the affected hosts; only then rotate every credential they could reach; and finally change your install defaults so the next one never executes. November 2026 showed why the "did it run" step matters. Sonatype's PolinRider finding (published November 4) hid loaders that run on require(), so --ignore-scripts doesn't stop them. The @ethersphere/bee-js 13.3.0 compromise on November 9 used a classic postinstall hook and was live for about 75 minutes.
This is the runbook I use, with a lockfile scanner you can point at any repo, the containment order that avoids a known worm booby-trap, and the npm 12 and pnpm settings that would have stopped most of 2026's incidents.
The November 2026 npm incidents in brief
| Incident | Dates (2026) | What was hit | How the code runs | Source |
|---|---|---|---|---|
| PolinRider loaders | Published Nov 3, reported Nov 4 | 12 releases across 10 hijacked packages, e.g. cdeops@13.5.31, server-hemera-mongo@0.0.15 and 0.0.16, several @adminide-stack/* |
When the affected entrypoint is loaded (require/import), no install script |
Sonatype |
| bee-js 13.3.0 | Nov 9, 00:09:50 – 01:24:58 UTC | @ethersphere/bee-js@13.3.0, plus a trojanized Swarm Desktop 0.56.2 |
postinstall hook rewritten into a remote loader |
Socket, GHSA-hh7j-5m3j-23pf |
Both used Ethereum as part of their command and control, which is now a common pattern. PolinRider reads a transaction from a fixed wallet (0x1eef0849eda15d87f64e51c73c8442cf3c8bcef3) and decodes C2 IP addresses from the recipient field. The bee-js loader reads its hub address from a smart contract. Because of that design, blocking one IP doesn't disable the loader: the operator just writes a new address on-chain.
Two details change how you respond. First, bee-js 13.3.0 was published through the project's legitimate npm trusted-publishing workflow from compromised GitHub accounts, so its provenance attestation is genuine. Provenance tells you where a package was built, not whether anyone reviewed the code. Second, the PolinRider packages had no install hooks at all, so a lockfile hit tells you the package was present but not whether its code ran.
For context: the self-propagating worm that hit keyv, flat-cache and cache-manager (Microsoft calls it ChainDrop) was in August 2026, not November. It used a preinstall hook and spread to more than 400 packages using stolen npm tokens. I mention it because its containment lesson applies to every incident below.
Step 1: Find the compromised npm package in lockfiles, caches and CI
Start with a plain list of bad versions from the advisories, one name@version per line. Get them from the primary write-up (Sonatype, Socket, the GitHub advisory, or OSV's MAL- entries), not from a news summary. Version lists in secondary coverage often disagree.
# iocs-2026-11.txt
@ethersphere/bee-js@13.3.0
cdeops@13.5.31
server-hemera-mongo@0.0.15
server-hemera-mongo@0.0.16
@adminide-stack/client-redux@0.0.16-18
@adminide-stack/utils@0.0.16-129
@adminide-stack/utils@0.0.16-130
@adminide-stack/health-api-server@0.0.18-alpha.465
@adminide-stack/user-activity-browser@1.1.3-alpha.114
@adminide-stack/forms-core@5.1.9-alpha.3
@adminide-stack/yantra-help-browser@12.0.194
@cdmbase/wiki-browser@12.0.18-alpha.53
@pubngo-stack/help-browser@12.0.23-alpha.3
That's the full set of 12 PolinRider releases from Sonatype's table plus bee-js. Then scan every lockfile format in the repo. This script needs Node 18 or later and has no dependencies. It handles package-lock.json, npm-shrinkwrap.json, pnpm-lock.yaml and both Yarn lockfile formats, and it exits non-zero on a hit so you can use it as a CI gate:
// scan-lockfiles.mjs — usage: node scan-lockfiles.mjs <ioc-file> [repo-root]
import { readFileSync, readdirSync, statSync } from 'node:fs';
import { join } from 'node:path';
const [iocFile, root = '.'] = process.argv.slice(2);
const bad = new Set(
readFileSync(iocFile, 'utf8').split('\n').map((l) => l.trim()).filter((l) => l && !l.startsWith('#'))
);
const LOCKS = new Set(['package-lock.json', 'npm-shrinkwrap.json', 'pnpm-lock.yaml', 'yarn.lock']);
const SKIP = new Set(['node_modules', '.git']);
function* walk(dir) {
for (const name of readdirSync(dir)) {
if (SKIP.has(name)) continue;
const p = join(dir, name);
if (statSync(p).isDirectory()) yield* walk(p);
else if (LOCKS.has(name)) yield p;
}
}
function entries(file, text) {
const out = [];
if (file.endsWith('.json')) {
for (const [key, meta] of Object.entries(JSON.parse(text).packages ?? {})) {
const i = key.lastIndexOf('node_modules/');
if (i >= 0 && meta.version) out.push(`${key.slice(i + 13)}@${meta.version}`);
}
} else if (file.endsWith('pnpm-lock.yaml')) {
for (const m of text.matchAll(/^ {2}'?((?:@[^/\s]+\/)?[^@\s'(]+)@(\d[^('\s:]*)/gm)) out.push(`${m[1]}@${m[2]}`);
} else {
// yarn.lock v1 and Berry: header line, then an indented version field
for (const m of text.matchAll(/^"?((?:@[^/\s"]+\/)?[^@\s"]+)@[^\n]*\n\s+version:? "?([^"\s]+)"?/gm)) out.push(`${m[1]}@${m[2]}`);
}
return out;
}
let hits = 0;
for (const file of walk(root)) {
for (const id of new Set(entries(file, readFileSync(file, 'utf8')))) {
if (bad.has(id)) { hits++; console.log(`HIT ${id} in ${file}`); }
}
}
console.log(hits ? `${hits} match(es) found` : 'no matches');
process.exitCode = hits ? 1 : 0;
I tested it against an npm lockfile, a pnpm v9-format lockfile and hand-written Yarn v1 and Berry lockfiles. A hit looks like this:
HIT @ethersphere/bee-js@13.3.0 in ioc/c/yarn.lock
HIT cdeops@13.5.31 in ioc/c/yarn.lock
2 match(es) found
The current lockfile is not the whole story
A clean lockfile today doesn't mean you never installed the bad version. bee-js was only on latest for 75 minutes, and a CI job that ran npm install (not npm ci) in that window could have resolved 13.3.0 and then been overwritten later. Also check:
- Lockfile history:
git log -p --since=2026-11-01 -- '**/package-lock.json' '**/pnpm-lock.yaml' '**/yarn.lock' | grep -n 'bee-js' - CI logs: search build logs in the exposure window for the package name and version.
- Local caches: npm's cache index stores the tarball URL, so
grep -rl "bee-js/-/bee-js-13.3.0.tgz" ~/.npm/_cacache/index-v5shows whether a machine ever fetched it. For pnpm, check the content-addressable store atpnpm store path. - Internal registries and mirrors (Artifactory, Nexus, Verdaccio): check download logs and whether the version is still cached and being served.
- Container images built during the window. An image is a frozen
node_modules, so scan it with the same tool you use for an SBOM. Our SBOM guide covers Syft and Trivy for this.
npm ls <pkg> --all (or pnpm why <pkg> -r) shows which direct dependency pulled it in. For bee-js, Socket lists @ethersphere/swarm-cli 3.6.0 and 3.7.0, @ethersphere/bee-dashboard 0.37.x, @snaha/swarm-id, @solarpunkltd/file-manager-lib, bee-wasm-js and new create-swarm-app projects as allowing 13.3.0 through their version ranges.
Step 2: Decide whether the code actually ran
This step sets how big your response is.
| Trigger | Ran if… | Evidence to look for |
|---|---|---|
postinstall/preinstall hook (bee-js, ChainDrop) |
It was installed with scripts enabled: npm 11 or older, Yarn classic, or an allowlist that covered it | Install logs; npm 12's "install scripts blocked" warning means it did not run |
| Import-time loader (PolinRider) | Your code loaded the affected entrypoint (for example require('cdeops/client'), or server-hemera-mongo's dist/main.js at app start) |
Process and network telemetry; --ignore-scripts is irrelevant here |
| Desktop app (Swarm Desktop 0.56.2) | The app was launched | Version in bee-desktop.log |
Host and network indicators from the primary write-ups:
- PolinRider: detached
node -iprocesses started by another Node process with piped stdin; plain HTTP to95.135.181.151on TCP 443 for the paths/0x/clsand/0x/ls. Sonatype also warns that an import error doesn't prove the loader didn't run. - bee-js: requests to
api.frameworkmetrics.xyz; on macOS and Linux, persistence under~/.solidity/, a LaunchAgentcom.solidity.langsupport.runneror a systemd user unitsolidity-langsupport-runner.service; on Windows, a ScreenConnect client service.
# Quick host checks (Linux/macOS)
ps -eo pid,ppid,lstart,command | grep -E '[n]ode -i'
ls -la ~/.solidity ~/Library/LaunchAgents/com.solidity.langsupport.runner.plist 2>/dev/null
systemctl --user list-unit-files 2>/dev/null | grep -i solidity
If none of these show up, that's encouraging but not proof. The ChainDrop payload, for one, deleted its own state.
Step 3: Contain first, then rotate
Every write-up ends with "rotate your credentials". The order matters more than people expect.
- Isolate the host before you revoke anything. The SANS Internet Storm Center's analysis of the keyv/cacheable worm describes a dead-man's switch. The malware polled the GitHub API with the stolen token, and once that started returning 4xx errors (that is, after you revoked it) it ran an attacker-supplied handler. Cutting the host's network first takes that trigger away. Don't power it off if you want memory and process evidence.
- Preserve evidence: a disk snapshot or image,
psoutput, open connections, and thenode_modulesof the affected project. - Rotate from a different, clean machine. GitHub's bee-js advisory says it directly: assume full compromise, and rotate "from a different computer".
- Rotate everything the process could read, not just what you think it targeted: npm tokens (
npm token list, thennpm token revoke <id>), GitHub personal access tokens andghCLI tokens, SSH keys, cloud credentials and instance or task roles, Kubernetes configs, Vault tokens, every.envvalue, and CI secrets in any pipeline that ran an install during the window. If you published packages from that machine or pipeline, check your own recent npm versions for anything you didn't release. - Rebuild, don't clean. CI runners and any host with confirmed execution should be rebuilt from known-good images. Then reinstall from a lockfile pinned to the clean version (bee-js 13.2.0) and purge caches (
npm cache clean --force,pnpm store prune).
CI secrets are where these incidents do the most damage, and long-lived cloud keys stored as pipeline secrets are the jackpot. Moving deploys to short-lived OIDC credentials means there's nothing durable to steal. Our GitHub Actions OIDC guide walks through AWS, GCP and Azure.
Step 4: Prevent the next compromised npm package from executing
No single control covers all three trigger types, so layer them.
| Control | Stops install hooks (bee-js, ChainDrop) | Stops import-time loaders (PolinRider) | Stops fresh malicious versions |
|---|---|---|---|
| Install scripts off by default (npm 12, pnpm) | Yes | No | No |
| Minimum release age (cooldown) | Yes, if the bad version is pulled inside the window | Yes, same condition | Yes |
Lockfile-only installs (npm ci, frozen lockfile) |
Yes, for versions not already locked | Same | Yes |
| Registry firewall / blocklist | Once the version is known | Once known | Once known |
npm 12: install scripts are off by default
npm 12.0.0 was published on July 8, 2026, and dependency preinstall, install and postinstall scripts no longer run unless the package is allowlisted in package.json. Here's what that looks like on npm 12.2.3 with a dependency that has a postinstall:
npm warn install-scripts 1 package had install scripts blocked because they are not covered by allowScripts:
npm warn install-scripts esbuild@0.25.0 (postinstall: node install.js)
npm warn install-scripts Run `npm install-scripts ls` to review, or `npm install-scripts approve <pkg>` to allow.
Approving writes a version-pinned entry, so a new release of the same package has to be approved again:
npm install-scripts approve esbuild
# package.json now contains: "allowScripts": { "esbuild@0.25.0": true }
In CI, make an unreviewed script a hard failure rather than a warning:
npm ci --strict-allow-scripts
# npm error code ESTRICTALLOWSCRIPTS
npm 12 also defaults allow-git and allow-remote to none, so git and tarball-URL dependencies have to be opted in. If you're still on npm 11 (which is what Node 24 bundles), ignore-scripts=true in .npmrc is the blunt equivalent, but it breaks packages like esbuild and sharp that really do need their install step. Upgrading to npm 12 and keeping an allowlist is the better answer.
Minimum release age
Most malicious versions are found and pulled within hours or days. bee-js lasted 75 minutes. A cooldown means you never install a version younger than the window. npm has had min-release-age (in days) since 11.10.0:
# .npmrc
min-release-age=7
pnpm already applies a default minimumReleaseAge of 1440 minutes (one day), though in non-strict mode for backward compatibility. Set it explicitly and add the rest of pnpm's supply-chain settings in pnpm-workspace.yaml. I tested this file with pnpm 12.8.1:
minimumReleaseAge: 10080 # minutes: only install versions at least 7 days old
minimumReleaseAgeExclude:
- next # let urgent security releases through
allowBuilds:
esbuild: true
strictDepBuilds: true # unreviewed build scripts fail the install
blockExoticSubdeps: true # only direct deps may use git/tarball sources
trustPolicy: no-downgrade # fail if a package's trust level drops vs earlier releases
The catch with a cooldown is that it also delays security fixes. When I set min-release-age=30 and installed next@16, npm resolved 16.4.3, which predates the November Next.js security release. npm's docs note that if the window blocks a fix npm audit fix wants, npm keeps the vulnerable version and exits non-zero. Use the exclude lists (min-release-age-exclude in npm, minimumReleaseAgeExclude in pnpm) for packages you need to patch fast, and keep the window short. Seven days is a reasonable default.
Lockfile-only installs and a firewall
In CI, never let an install resolve new versions: use npm ci (which fails if package.json and the lockfile disagree), pnpm install --frozen-lockfile, or yarn install --immutable. Dependency updates should arrive as reviewed pull requests that change the lockfile, ideally with the cooldown applied. Then put a blocklist in front of the registry so a version flagged as malware can't be installed by anyone. Our GitHub Package Firewall guide covers one way to do that. If you maintain packages yourself, bee-js is a good argument for npm trusted publishing done properly: protected publish environments with required reviewers, tests on the release path, and no publishing from arbitrary branches.
Frequently Asked Questions
How do I know if I installed a malicious npm package?
Scan every lockfile for the exact name@version strings from the advisory, then check lockfile git history, CI logs from the exposure window, your npm or pnpm cache and any internal registry. A hit tells you it was present. Whether it ran depends on whether it used an install hook or an import-time loader.
Does --ignore-scripts protect against npm malware?
Only against malware that runs from preinstall, install or postinstall. The PolinRider loaders Sonatype reported in November 2026 run when the package is imported, so disabling install scripts doesn't stop them. Combine script controls with a minimum release age and lockfile-only installs.
What should I rotate after a compromised npm package?
Everything the affected process could read: npm and GitHub tokens, SSH keys, cloud credentials and roles, Kubernetes and Vault credentials, .env values and CI secrets. Isolate the host first and rotate from a clean machine. At least one 2026 worm acted when its stolen token was revoked.
Does npm 12 block postinstall scripts by default?
Yes. Since npm 12.0.0 (July 2026), dependency install scripts are blocked unless the package is listed in the allowScripts field of package.json. Use npm install-scripts approve <pkg> to allow one, and --strict-allow-scripts in CI to make unreviewed scripts fail the install.
Is the bee-js package safe now?
Version 13.3.0 was malicious and was removed from npm on November 9, 2026. Pin @ethersphere/bee-js to 13.2.0. If 13.3.0 was installed with scripts enabled, GitHub's advisory says to treat the machine as fully compromised and rotate its secrets from another computer.
What is the difference between npm min-release-age and pnpm minimumReleaseAge?
They do the same job with different units. npm's min-release-age is in days and is unset by default. pnpm's minimumReleaseAge is in minutes and defaults to 1440 (one day) in non-strict mode. Both have exclude lists for packages that need urgent updates.
Conclusion
The two November 2026 incidents need different defenses. bee-js would have been stopped by npm 12's default script blocking or by any cooldown longer than 75 minutes. PolinRider walks straight past script controls and is only stopped by not installing the version in the first place. Run the lockfile scanner across your repos with the published IOC list, prove whether code ran before you decide how far to escalate, isolate before you revoke, and then make npm 12 with --strict-allow-scripts, a seven-day minimum release age and frozen-lockfile CI installs your default. If you're choosing a package manager partly on these controls, our pnpm vs npm vs Yarn vs Bun comparison covers the rest of the trade-offs.