In short: An npm supply chain attack is when malicious code is published inside an npm package that developers already trust, so it runs on their laptops and build servers during a normal install. In 2026 the self-spreading Shai-Hulud worm compromised more than 1,300 package versions, and a separate flaw called SlugFest let attackers take over packages through npm's trusted publishing. If your team builds with JavaScript or TypeScript, check whether you installed affected versions, rotate any exposed secrets, and change how you install and publish packages.
Key takeaways
- The Cyber Security Agency of Singapore (CSA) advisory AD-2026-009, last updated on 3 November 2026, says the Shai-Hulud "ChainDrop" campaign compromised over 1,300 npm package versions with a combined 2 billion monthly downloads.
- The worm started on 4 August 2026 from a compromised GitHub maintainer account behind the keyv caching library, according to Wiz.
- On 2 October 2026 GitHub made unvalidated npm trusted publishing configurations expire after 48 hours and blocked publishing from GitHub Actions
issue_comment events.
- On 13 October 2026 Help Net Security reported Bloom Security's SlugFest flaw, which exposed more than 1,500 npm packages to takeover through renamed or deleted GitHub repositories.
- npm's own settings, such as
min-release-age and ignore-scripts, plus trusted publishing with tokens disallowed, close most of the easy paths.
What is an npm supply chain attack?
An npm supply chain attack is the compromise of a package, its maintainer or its publishing pipeline on the npm registry, so that a trusted name delivers malicious code. Install scripts and imports run with the full rights of the developer or CI runner, which is why the usual target is credentials: cloud keys, GitHub tokens, SSH keys and npm publish tokens. A worm is the variant that uses stolen publish tokens to infect more packages by itself.
This guide is by the ApexlyTech team at Apexly Technologies (Pvt) Ltd. We build web, SaaS and mobile applications on JavaScript and PHP stacks, so these are controls we apply to our own pipelines.
What happened in the 2026 Shai-Hulud worm?
The Shai-Hulud worm is a family of self-propagating npm malware; the 2026 wave began with the keyv and cacheable libraries. Wiz reported on 4 August 2026 that a compromised GitHub maintainer account was used to push payloads to the keyv repository and then to publish an infected keyv version. The CSA lists, among others, keyv 6.0.0, cacheable 2.5.1, flat-cache 6.1.24, file-entry-cache 11.1.6, cache-manager 7.2.10 and cacheable-request 13.0.20, and points to Socket for the full list.
What the payload did, according to Wiz:
- Harvested cloud credentials, CI/CD secrets, SSH keys, crypto wallets and the credential stores of AI coding assistants.
- Persisted on developer machines through AI coding agent hooks and VS Code
tasks.json, with a setup.mjs file in .claude and .vscode folders.
- Exfiltrated data to GitHub repositories created under victims' accounts with the description "Shai-Hulud: Here We Go Again".
- Fetched its command-and-control address from an Ethereum smart contract, which makes simple domain blocking less effective.
The CSA advisory was still being updated on 3 November 2026, so treat the campaign as ongoing.
What is SlugFest and how does trusted publishing fail?
Trusted publishing is npm's way of publishing from CI with short-lived OpenID Connect (OIDC) credentials instead of long-lived tokens; you bind a package to a specific repository and workflow file. SlugFest is the name Bloom Security gave to a flaw in how that binding was checked. According to Help Net Security on 13 October 2026, npm matched the repository by its owner/name "slug" rather than GitHub's permanent numeric IDs. If a bound repository was renamed, transferred or deleted, anyone who re-created that name with a matching workflow could publish the package, and the release would even carry a valid provenance attestation naming the attacker's repository.
Bloom reported the issue through GitHub's bug bounty on 6 June 2026 and counted more than 1,500 exposed packages; it is not known whether anyone exploited it. GitHub's changelog entry of 2 October 2026 introduced two fixes:
- Unvalidated trusted publishing configurations expire 48 hours after creation; a configuration is validated by its first successful publish.
- npm rejects trusted publishing tokens from GitHub Actions
issue_comment events, in addition to pull_request_target. Publish from push, release or workflow_dispatch instead.
Who is affected?
Anyone who ran npm install, pnpm install or yarn on a project that resolved an affected version, on a laptop or a CI runner. Laravel, Django and Rails teams are included: their front-end build steps pull in npm packages and their dependencies. Maintainers who publish packages are a second group, because their tokens are exactly what the worm spreads with.
What should you do now? A response checklist
- Search lockfiles for affected versions. Check
package-lock.json, pnpm-lock.yaml and yarn.lock in every repository and in old CI caches against the CSA and Socket lists.
- Treat matching machines as compromised. The CSA advises rebuilding systems that installed the malicious versions rather than cleaning them.
- Rotate secrets. Cloud credentials, GitHub tokens, SSH keys, Kubernetes configs, Terraform credentials and npm tokens from any affected host.
- Look for persistence and exfiltration. Unexpected
setup.mjs files in .claude or .vscode, commits titled "chore: update config", and new repositories in your organisation described "Shai-Hulud: Here We Go Again".
- Review cloud and Git audit logs for access after the install date.
- Block the published indicators (domains and file hashes in the CSA advisory) in your proxy and endpoint tools.
How do you prevent the next one?
The settings below are documented in npm's own configuration reference and trusted publishing guide. None is complete on its own.
| Control | What it does | Where |
min-release-age | Installs only versions published more than the given number of days ago, so a freshly poisoned release is skipped | .npmrc, for example min-release-age=3 |
ignore-scripts=true | Stops npm running package lifecycle scripts during install | .npmrc in CI and on laptops; allow scripts only where a build needs them |
allow-git | Restricts git-hosted dependencies (all, none or root) | .npmrc |
npm ci with a committed lockfile | Installs exactly what was reviewed rather than resolving new versions | CI pipelines |
| Trusted publishing | Publishes with short-lived OIDC credentials instead of stored tokens | npm package settings plus id-token: write in the workflow |
| Disallow tokens and require 2FA | Stops a stolen token from publishing your package | npm package publishing access |
For package maintainers
- Move publishing to trusted publishing. npm's documentation requires npm CLI 11.5.1 or later and Node.js 22.14.0 or later, and supports GitHub Actions, GitLab CI/CD and CircleCI on hosted runners only.
- Then set publishing access to require two-factor authentication and disallow tokens, which npm recommends and which does not affect trusted publishers.
- Run
npm trust list and confirm every bound repository still exists under an account you control, as Bloom recommends; remove a binding before renaming or deleting a repository.
- Publish only from
push, release or workflow_dispatch events.
For teams that consume packages
- Run installs in CI with no cloud credentials in the environment; inject deployment secrets only in a later, separate job.
- Give AI coding agents the same rules as people: they install packages too, and the 2026 worm targeted their configuration files.
- Check that a package's provenance names the repository it should come from.
- Keep a software bill of materials (SBOM) per release so you can answer "did we ship version X?" in minutes. Our EU Cyber Resilience Act guide explains why SBOMs are becoming a legal duty for software sold in the EU.
Patching the runtime matters as much as the packages; see our php2shell patch guide for the October 2026 PHP vulnerabilities.
How ApexlyTech can help
We build and run CI/CD pipelines for web and SaaS products, and can review your dependency and publishing setup, move packages to trusted publishing, separate build and deploy secrets, and add lockfile and SBOM checks to every release. See our web application development and cloud solutions services, or contact us.
Frequently asked questions
How do I know if I installed a compromised npm package?
Search your lockfiles and CI caches for the versions listed in the CSA advisory and Socket's full list, such as keyv 6.0.0 or cacheable 2.5.1. Then check developer machines for unexpected setup.mjs files in .claude or .vscode folders, and your GitHub organisation for repositories described "Shai-Hulud: Here We Go Again".
Is deleting node_modules enough after an npm supply chain attack?
No. The malware runs at install time and steals credentials, then can persist through editor and AI agent configuration files. The Cyber Security Agency of Singapore advises treating the system as compromised, rebuilding it, and rotating every credential it could reach, including cloud keys, GitHub tokens and SSH keys.
What is npm trusted publishing?
Trusted publishing lets a CI workflow publish an npm package using short-lived OpenID Connect credentials instead of a stored token. You bind the package to a repository and workflow file in npm's settings. Since 2 October 2026, a new binding expires after 48 hours unless it completes a successful publish.
What does npm min-release-age do?
min-release-age is an npm configuration setting that installs only package versions published more than a given number of days ago. Setting it to a few days means a freshly poisoned release, which is usually found and removed quickly, is skipped. It trades a short delay on new versions for safety.
Was SlugFest exploited?
It is not known. Bloom Security, which found the flaw, demonstrated it only with packages and repositories it controlled and has not published the names of the more than 1,500 exposed packages. GitHub says it has shipped fixes, including the 48-hour expiry for unvalidated trusted publishing configurations announced on 2 October 2026.
Sources
All sources checked 3 November 2026.