TL;DR: Malicious versions of keyv and cacheable spread through npm as a self-propagating worm that harvested credentials from developer and CI machines and republished to other packages, according to Cloudsmith. The attack shows that dependency trust fails when install-time code execution can turn one compromised package into a broad publishing channel.
At a glance
What this is: NHI Mgmt Group's analysis, drawing on Cloudsmith's blog post: The keyv and cacheable supply-chain attack used install-time worm behaviour to spread malicious npm releases through transitive dependencies.
Why it matters: This matters because npm installs can become a credential-exposure event, and teams need controls that govern what enters builds before execution starts.
By the numbers:
- The attack had grown to 2,236 package versions by the time Cloudsmith published its analysis.
- Roughly 444 legitimate packages were affected in the campaign Cloudsmith tracked.
Context
A software supply chain attack can turn routine package installation into code execution, credential theft, and downstream propagation when malicious releases are published to trusted dependencies. In npm ecosystems, the risk is amplified because transitive packages can enter developer laptops and CI systems without being consciously selected by the team.
This campaign is a useful reminder that dependency trust is not just about package reputation. Once install-time scripts run in build or developer environments, the package becomes an execution channel, and that is where CI/CD pipeline identity security starts to matter as much as artifact hygiene.
The starting position here is not typical of a one-off typo-squat. It is a worm-like campaign that exploits legitimate packages and supply-chain speed, which makes containment harder than simple package removal.
Key questions
Q: How should teams reduce risk from malicious npm package installs?
A: Treat package installation as a controlled operation, not an implicit trust event. Restrict secret exposure in build environments, separate publish rights from routine development access, and make secret rotation and revocation part of incident response, especially for systems that handle CI/CD credentials.
Q: Why do transitive dependencies create more software supply chain risk than direct packages alone?
A: Transitive dependencies hide exposure inside nested libraries that are often missed by top-level package reviews. If defenders only track direct components, they can miss the code attackers are most likely to exploit. A dependency-aware inventory reduces that blind spot and gives teams a realistic view of what is actually present in production.
Q: How does install-time code execution expose build credentials?
A: Install-time code execution exposes build credentials when a package, installer, or setup script runs with the privileges and network access of the build environment, letting attacker-controlled code read environment variables, files, or secret stores. CI tokens, signing keys, cloud credentials, and npm, pip, or container registry secrets can then be exfiltrated or used to tamper with downstream artefacts.
Q: What is the best way to contain a self-propagating supply-chain worm?
A: A self-propagating supply-chain worm is contained by cutting its automated reach, usually with a controlled proxy, egress filtering, package allow-lists, and rapid revocation of build or publishing tokens. Isolate affected runners, block unauthorised dependency fetches, freeze release pipelines, and rotate any credentials that the worm could reuse to spread further.
Technical breakdown
How install-time scripts turn npm packages into execution channels
npm packages can execute lifecycle scripts during install, including preinstall hooks that run before the package is fully accepted into a project. That makes the package manager part of the attack surface, because the install process is not just file retrieval but code execution. When a malicious package ships a preinstall payload, the code runs in the context of the developer workstation or CI runner that pulled it, which can expose tokens, environment variables, and cached credentials. In this campaign, the key technical issue is that trusted dependency resolution and executable content were fused into one step. See the Node.js Security Guide.
Practical implication: Treat install-time script execution as a privileged operation and block it where your build model does not require it.
Why transitive dependencies create blast radius in package ecosystems
Transitive dependencies are packages your team consumes indirectly through other packages, which means a compromise can propagate far beyond the libraries you explicitly chose. In JavaScript ecosystems, popular tooling often sits several layers deep in the dependency graph, so a malicious update to a common subdependency can reach many projects at once. That is why the campaign expanded so quickly: the attacker did not need to compromise each downstream team individually. The propagation path was already present in the dependency graph, and install-time execution allowed the malicious code to reach exposed machines before defenders could react. Read Dependency Pinning vs Version Ranges.
Practical implication: Map transitive exposure and treat indirect packages as part of your governed software bill of materials.
Why publishing-token theft turns a package compromise into a worm
A worm differs from a simple package backdoor because it uses one compromise to create the next. Here, the payload harvested credentials and then used any stolen npm publish tokens to push malicious versions to other packages under the compromised account's control. That creates a feedback loop: the infection steals the capability needed to spread. In supply-chain terms, the trust relationship is not only with the registry but also with the maintainer credentials that can publish to it. Once those credentials are exposed, the attacker gains a second distribution path that bypasses normal review. See the npm Tokens Security Guide.
Practical implication: Assume publishing credentials are a propagation asset and monitor them as closely as source code access.
Threat narrative
Attacker objective: The attacker aimed to steal credentials and turn trusted package publishing channels into a self-spreading distribution mechanism.
- Entry occurred when malicious versions of legitimate npm packages were published into the dependency ecosystem and pulled during normal installs.
- Credential harvest followed through preinstall scripts that executed on developer and CI machines and searched for secrets and tokens.
- Escalation happened when stolen npm publish tokens were reused to publish malicious versions of other packages controlled by the compromised accounts.
- Impact was broad supply-chain propagation, with hundreds of packages and thousands of versions exposed across downstream builds and workstations.
Breaches seen in the wild
- Shai-Hulud npm worm first wave 2025: The first Shai-Hulud wave used stolen npm tokens to trojanise 500+ packages, starting with tinycolor, and leaked developer and CI secrets on GitHub.
- Bitwarden CLI npm compromise 2026: A malicious Bitwarden CLI on npm, linked to the Checkmarx campaign, targeted GitHub, npm, cloud and CI secrets from developers for 90 minutes.
Read and download The State of NHI & AI Agent Breach Report 2026, covering 200+ breaches impacting Non-Human Identities including AI Agents.
NHI Mgmt Group analysis
Supply-chain trust collapses when execution and distribution happen in the same install step. npm ecosystems have long relied on package reputation and lockfile discipline, but this campaign shows that trust is broken earlier, at install time. Once a package can execute code during installation, the registry becomes part of the runtime attack surface, not just a source of artifacts. Practitioners should treat package admission as an execution decision, not a download decision.
Transitive dependency exposure is now an identity problem as much as a code problem. The malicious payload did not need direct access to every target system; it only needed a path into environments holding publish tokens, cloud credentials, or CI secrets. That means the governance question is who and what can authenticate inside build environments, not just which packages are approved. Teams should read this through the lens of CI/CD pipeline identity security and credential containment.
Wormability is the right named concept for modern package compromise. This campaign is not just malware in a registry. It is a propagation model that combines package trust, token theft, and maintainer permissions into a single growth loop. That matters because the control objective changes from detecting one bad release to shrinking the conditions that let one release self-propagate through build and publish pipelines.
Registry enforcement has to sit between intake and execution. Once a malicious version reaches a developer laptop or CI runner, the damage can happen before manual review catches up. The practical lesson is that policy, cooldowns, and malware gating are most effective when they intercept packages before they are installable, not after they are already cached or executed.
From our research library:
- The blast radius of the Salesloft-Drift OAuth supply chain attack was 10 times greater than earlier incidents in which attackers breached Salesforce directly.
- Read next: Supply chain NHI breaches
What this signals
Dependency trust is becoming an execution problem, not just an integrity problem. As package ecosystems keep blurring the line between install and run, teams need to assume that any dependency update can become a runtime event. That changes the governance baseline for CI/CD, because the control point has to move closer to package admission and script suppression.
Wormable package attacks will keep rewarding speed over caution. The ecosystem will continue to see campaigns that exploit the gap between publication and community detection, especially where transitive packages are deeply embedded in common tooling. Organisations that cannot control intake paths will keep discovering that fresh installs create more exposure than stale lockfiles.
Cloudsmith's analysis also shows how quickly the blast radius can grow when malicious packages sit inside routine build flows, a pattern that continues to reward registry-level enforcement over manual triage.
For practitioners
- Disable lifecycle scripts where they are not required Prevent preinstall and other lifecycle hooks from running in developer and CI environments unless a package truly needs them for build-time behaviour.
- Enforce registry cooldowns for newly published packages Hold back recently published upstream versions long enough for community review, especially for common transitive dependencies with large downstream reach.
- Quarantine affected versions in your internal proxy Block malicious or suspicious package versions at the registry boundary and ensure cached copies cannot be pulled into fresh builds.
- Rotate credentials after any confirmed install-time execution Replace npm publish tokens, cloud credentials, and other secrets that may have been reachable from a machine that executed a malicious package.
Key takeaways
- The incident shows that a package compromise becomes materially worse when malicious code can execute during install and steal publish credentials.
- Cloudsmith reported roughly 444 legitimate packages and 2,236 malicious versions during the campaign, which gives a sense of how fast self-propagation can scale.
- The limiting control is to intercept newly published packages before they reach installs, then revoke exposed tokens and quarantine affected versions after any confirmed execution.
Related NHI Mgmt Group resources: Shai-Hulud npm Worm Guide · npm Tokens Security Guide · CI/CD Pipeline Identity Security Guide · Shai-Hulud npm worm first wave 2025
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Non-Human Identity Top 10 and MITRE ATT&CK address the attack and risk surface, while CIS Controls v8 and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Non-Human Identity Top 10 | NHI-02 — Secret Leakage | The campaign steals secrets from build and developer environments during package execution. |
| NHI-07 — Long-Lived Secrets | Stolen npm and cloud tokens become reusable propagation assets when they are long lived. | |
| Recommendation — Block secret exposure in build paths and revoke any NHI credentials touched by a malicious install. Shorten token lifetime and rotate any publish credentials that could survive a compromised install. | ||
| MITRE ATT&CK | TA0006;TA0010 — Credential Access; Exfiltration | The payload harvests credentials and uses them to spread through package publishing channels. |
| Recommendation — Map package-install detections to credential access and exfiltration activity in CI and developer estates. | ||
| CIS Controls v8 | CIS-5 — Account Management | Publishing tokens and CI accounts are the accounts abused to propagate malicious package releases. |
| Recommendation — Review and disable stale publishing accounts and tokens that could be reused in package infrastructure. | ||
| NIST CSF 2.0 | PR.AA-05 — Access Permissions, Entitlements and Authorizations | Package publish and CI permissions determine whether a compromise can spread to other releases. |
| Recommendation — Limit publish permissions and entitlements so compromised build identities cannot republish packages. | ||
Key terms
- Keyv and Cacheable npm Supply-Chain Attack: A supply-chain compromise in which malicious versions of legitimate npm packages are published to spread malware through normal dependency installs. The term matters because the attack abuses trusted package distribution rather than a simple typo-squat, which makes the registry, install process, and maintainer credentials part of the threat surface.
- Install-Time Script: An install-time script is code that executes when a package is installed, before the package has necessarily been validated in context. Attackers abuse these scripts because they can trigger silently in developer machines and CI systems, turning dependency installation into an execution path.
- Transitive Dependency: A package that your software uses indirectly because one of its own dependencies pulls it in, as opposed to a direct dependency that your project declares. Most components in a typical application are transitive, so reviewing the manifest alone misses most risk. Visibility, such as full dependency trees and runtime validation, is needed to know what code is actually present.
- Publishing Token: A publishing token is a credential that authorizes a system or identity to send content, updates, or artifacts into a trusted service or platform. In NHI governance, it is treated as a secret with controlled scope, time limits, and revocation, because misuse can expose pipelines, data, or application integrity.
Deepen your knowledge
The NHI Foundation Level course, the industry's only accredited NHI security programme, covers NHI governance, workload identity, and secrets management. It helps security teams connect identity controls to build, release, and runtime risks across modern software supply chains.
Published by the NHIMG editorial team on November 25, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org