On August 4, 2026, Snyk Security Research identified 11 malicious releases of keyv, a widely-used npm package for simple key-value storage. The attacker compromised the release path and embedded malicious code that executed via a preinstall hook, triggering a second-stage payload. At 11:16 UTC, eight of these compromised versions were still tagged as latest, meaning any developer running npm install keyv would automatically pull down the malicious code.
The payload targeted CI/CD environments specifically. If your build pipeline installed or updated keyv during that window, the malware executed before your application code even ran.
Timeline
August 4, 2026, pre-11:16 UTC: Attacker publishes 11 malicious releases of keyv to npm registry. Each contains a preinstall hook pointing to a second-stage payload.
August 4, 2026, 11:16 UTC: Snyk Security Research identifies the compromise. Eight malicious versions still marked as latest.
August 4, 2026, post-11:16 UTC: Investigation reveals all 11 releases share identical payload files, suggesting systematic compromise rather than opportunistic injection.
The detection-to-disclosure window here matters. Between the first malicious publish and public identification, any automated dependency update in your pipeline could have pulled the compromised package. If you run npm update nightly or use Dependabot with auto-merge enabled, you had exposure.
Which Controls Failed
Package integrity verification: The npm ecosystem relies on publisher trust. Once an attacker controls the publishing credentials or infrastructure, they can push arbitrary code. No cryptographic signature verification happens by default when you install packages.
Preinstall hook monitoring: The preinstall script executed before your package manager even finished the install. Most organizations don't audit these hooks or restrict what they can do. Your CI/CD runner gave the script the same permissions it gives your build process.
Dependency pinning: If you specified "keyv": "^4.0.0" in package.json, npm pulled the latest 4.x release automatically. The caret operator meant you got the malicious version without changing a single line of your code.
Runtime monitoring in build environments: CI/CD pipelines typically run with elevated permissions and access to secrets. The malware targeted this environment specifically, but most teams don't monitor for unexpected network connections or file system access during the install phase.
What Standards Require
PCI DSS v4.0.1 Requirement 6.3.2 mandates that you maintain an inventory of bespoke and custom software, and third-party software components. The requirement explicitly includes tracking component versions and identifying those containing vulnerabilities. You can't track what you don't inventory, and you can't respond to a compromise if you don't know you're using the affected package.
NIST 800-53 Rev 5 control SR-4 (Provenance) requires documenting the development and delivery of software components. For supply chain security, this means verifying the source and integrity of components before deployment. The control specifically calls out tracking changes to components throughout the software development life cycle.
ISO/IEC 27001:2022 Annex A.8.30 addresses secure coding practices and includes managing the security of software supply chains. Organizations must implement processes to ensure the integrity of software components from external sources.
SOC 2 Type II CC6.8 requires monitoring system components for anomalies that could indicate security incidents. This applies to your build environment just as much as production. If a preinstall hook starts making network requests to unknown domains or accessing credential stores, your monitoring should catch it.
None of these standards say "use npm safely." They require you to know what you're running, verify its integrity, and detect anomalous behavior. The keyv compromise violated all three.
Lessons and Action Items
Pin your dependencies exactly. Replace "keyv": "^4.0.0" with "keyv": "4.5.2" in package.json. Yes, you'll need to update manually. That's the point. When you update, you review the changelog and diff the lockfile. Use npm ci instead of npm install in CI/CD to enforce the lockfile.
Audit install scripts before they run. Add a pre-install check in your pipeline:
npm pack --dry-run | grep -E "(pre|post)install"
If you see hooks you don't recognize, investigate before proceeding. Better yet, run installs in a restricted sandbox that can't access credentials or make external network calls.
Implement Software Bill of Materials (SBOM) generation. Run npm sbom --sbom-format cyclonedx after every install. Store the output. When a compromise like keyv happens, you can grep your SBOM archive to see which builds were affected and when. This directly supports PCI DSS Requirement 6.3.2.
Monitor your build environment like production. Your CI/CD runners need the same network egress monitoring, file integrity checks, and anomaly detection as your application servers. If a preinstall script tries to exfiltrate /root/.aws/credentials, you need to know immediately, not three weeks later during an incident review.
Use a private registry with scanning. Tools like Sonatype Nexus or JFrog Artifactory can scan packages before they reach your developers. When Snyk identified the malicious keyv releases, organizations using registries with integrated scanning got automatic blocks. Those pulling directly from npmjs.com had to wait for manual notification.
Test your incident response for supply chain events. Run a tabletop exercise: "We just discovered our builds from the last 48 hours included a compromised dependency. What do we check? Who do we notify? How do we determine blast radius?" If you can't answer these questions quickly, you're not ready for the next keyv.
The keyv compromise wasn't sophisticated. It relied on the same preinstall hook mechanism that legitimate packages use for build tools and native dependencies. Your defense isn't about blocking clever attacks. It's about not giving install scripts automatic access to everything your build environment can reach.



