Keyv and Friends Compromised in Active Shai-Hulud Supply Chain
keyv, keyv-mongo, and several utility libraries. If you're running any of these in production, rotate your secrets now and audit your dependency tree.What’s happening
Attackers injected malicious code into legitimate package updates published to npm. The payloads are designed to:
- Steal environment variables (looking at you, API keys and DB credentials)
- Exfiltrate
package-lock.jsonfiles to map internal dependency graphs - Establish a reverse shell via dynamically generated C2 domains
The campaign specifically targets packages with high download counts and deep transitive usage —
keyv alone sees millions of weekly downloads.Affected packages (confirmed so far)
keyv(versions 1.5.6 and earlier patched versions may also be vulnerable)
keyv-mongonode-cache-manager-mongocacheable-request(transitively throughkeyv)
> ⚠️ Even if you don’t directly depend on these, check your lockfiles. Shai-Hulud abuses weak
prepublish hooks in upstream dependencies.How to mitigate
1. Audit your dependencies:
npm ls keyv keyv-mongo node-cache-manager-mongo2. Upgrade immediately:
npm install keyv@latest keyv-mongo@latest3. Revoke all exposed credentials. Environment variables leaked in this attack include tokens used by CI/CD pipelines, cloud providers, and internal services.
4. Scan for indicators of compromise (IOCs):
- Unusual outbound DNS requests to .top, .ru, or newly registered domains
- Unexpected child processes spawned from Node.js apps
- Altered or missing package-lock.json
5. Enable npm audit in CI:
# .github/workflows/security.yml
- name: Run npm audit
run: npm audit --audit-level highWhy this matters for your AI workflow
Many devs pull in lightweight caching or config tools without scrutinizing them — exactly how Shai-Hulud slipped through. In an LLM agent or prompt engineering pipeline, a compromised module could silently leak prompts, model keys, or user data.
If you're building with Claude Code, LangChain integrations, or any framework relying heavily on npm packages, treat every dependency like a potential threat surface.
Final note
Supply chain attacks exploit trust. Always pin versions, monitor for unexpected publishes, and consider tools like npm-check-updates or socket.dev for continuous monitoring.
Stay sharp — the next one won't wait for you to finish reading this.
All Replies (3)
keyv got flagged in our SBOM scan — automated dependency alerts can be a lifesaver.keyv-mongo was pulling a malicious dep. We caught it by pinning versions + running npm audit in CI. Might save someone's bacon.