Join our Newsletter — 33% off our NHI Course
Home› Glossary› Threats, Abuse & Incident Response› Keyv and Cacheable npm Supply-Chain Attack
Threats, Abuse & Incident Response

Keyv and Cacheable npm Supply-Chain Attack

← Back to Glossary
By NHI Mgmt Group Updated November 25, 2026 Domain: Threats, Abuse & Incident Response

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.

What this attack is and why it matters

This is a software supply-chain attack pattern, not just a malicious-package event. The danger comes from abusing normal npm trust relationships, so a package can arrive through routine installs, reach developers and CI pipelines, and execute in environments that assume dependency traffic is benign.

That trust boundary makes the attack attractive at scale. Once a legitimate package is poisoned, the blast radius can include source repositories, build systems, developer workstations, secret stores and downstream applications that inherit the compromised dependency.

How the compromise typically works

The common path is account compromise, token theft, maintainer phishing, or another publishing-path weakness that lets an attacker upload a malicious version under a legitimate name. In many cases, the package itself is the delivery vehicle, so the initial code execution happens during install, postinstall hooks, or other dependency lifecycle steps.

Because npm resolves packages automatically, a malicious release can be consumed before teams notice anything unusual. That is why package integrity, publish controls, and install-time behaviour matter as much as the code inside the package.

What makes it dangerous in practice

This attack pattern is dangerous because it turns ordinary dependency management into a compromise path. A poisoned package can steal tokens, read environment variables, exfiltrate configuration, or alter build outputs while appearing to be a normal dependency update.

The impact often extends beyond the package registry. If the attacker reaches developer credentials, CI secrets, signing keys, or cloud access material, the compromise can spread from one package install into broader repository and infrastructure abuse.

For broader hardening guidance on Node.js and npm trust boundaries, Node.js Security Guide covers lockfiles, install scripts, trusted publishing, provenance, and token hygiene in one place.

How organisations reduce exposure

Exposure starts with knowing where the package is used, where installs happen, and which environments can reach the internet during dependency resolution. Teams should also check whether they rely on long-lived publish tokens, unrestricted install scripts, or unreviewed dependency updates in automated pipelines.

Supply-chain guidance from NIST SSDF (SP 800-218), SLSA, and OpenSSF reinforces the same themes: provenance, integrity, dependency governance, and reducing the chance that a malicious release can pass straight into production.

Detection and recovery after a suspicious release

Detection should focus on abnormal package behaviour, unexpected postinstall activity, new outbound connections from build hosts, and signs that secrets or tokens were accessed after installation. When a compromise is suspected, organisations should review dependency trees, pipeline logs, token usage, and repository audit trails to understand what the package touched.

Recovery is not just about removing the bad version. It also requires validating whether credentials, sessions, API keys, signing keys, or other secrets were exposed during the attack window, because the package may have been used to harvest more than code.

For incident context and threat patterns around software supply-chain compromise, ENISA Threat Landscape and CISA cyber threat advisories are useful authorities for understanding how supply-chain attacks are tracked and communicated.

Risk and Threat Considerations

Malicious npm publishing is risky because it weaponises a trusted distribution channel. The attacker does not need to break the registry itself if they can reach the maintainer account, publishing token, or release workflow that users already trust.

Failure mechanism: A compromised package version is installed automatically, then executes in developer, CI, or runtime contexts where it can steal secrets, alter builds, or establish persistence through dependency updates.

Impact: The result can be credential theft, poisoned builds, downstream compromise, and broader ecosystem exposure if the malicious package is pulled into multiple projects before it is detected.

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 addresses the attack and risk surface, while NIST SP 800-53 Rev 5, CIS Controls v8 and SLSA set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP Non-Human Identity Top 10NHI-02 — Secret LeakageMalicious npm packages often steal tokens and keys during install or postinstall.
NHI-05 — Overprivileged NHICompromised publish tokens or CI identities often have more access than needed.
NHI-07 — Long-Lived Secretsnpm supply-chain attacks frequently abuse durable publishing tokens and cached credentials.
Recommendation — Block secret exposure from package installs and rotate any credentials a poisoned dependency may have accessed. Reduce publish and pipeline privilege so a stolen token cannot publish or exfiltrate broadly. Replace long-lived npm secrets with short-lived, tightly scoped publishing credentials.
NIST SP 800-53 Rev 5IA-5 — Authenticator ManagementPublishing tokens, API keys, and developer secrets must be issued, rotated, and revoked safely.
SI-7 — Software, Firmware, and Information IntegrityThe subject is malicious software inserted into legitimate dependencies and consumed through normal installs.
SA-12 — Supply Chain ProtectionThis attack is a direct software supply-chain compromise of trusted third-party packages.
Recommendation — Enforce lifecycle control for npm publishing tokens and revoke them immediately after compromise. Verify package integrity and provenance before allowing dependencies into build or production environments. Apply supply-chain controls to npm dependency acquisition, review, and provenance validation.
CIS Controls v8CIS-5 — Account ManagementThe attack often begins with stolen maintainer access, tokens, or publishing accounts.
Recommendation — Harden and monitor maintainer and pipeline accounts that can publish or approve packages.
SLSASupply-chain Levels for Software ArtifactsSLSA directly addresses build provenance and integrity for software artifacts.
Recommendation — Adopt stronger provenance guarantees for npm packages and downstream build artifacts.

Practitioner Guidance

Why practitioners should care: Treat npm publishing credentials, dependency scripts, and release automation as part of the security boundary, not as routine developer convenience. The biggest mistakes happen when teams trust package updates more than they trust the systems that publish them.

What to watch for: Prioritise environments that allow install-time code execution, use long-lived maintainer tokens, or auto-merge dependency updates without strong provenance checks. Those are the conditions that let a package compromise turn into a broader identity and secrets incident.

Practitioner takeaway: The safest response is to combine tighter publishing controls with dependency provenance, then assume any exposed build or developer secret may need rotation after a confirmed compromise.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on November 25, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org