Keyv and Friends Compromised in Active Shai-Hulud Supply Chain
A new supply chain attack dubbed Shai-Hulud is actively compromising popular npm packages including 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
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)
prepublish hooks in upstream dependencies.
How to mitigate
1. Audit your dependencies:
npm ls keyv keyv-mongo node-cache-manager-mongo
2. Upgrade immediately:
npm install keyv@latest keyv-mongo@latest
3. 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 high
Why 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)
Our SBOM scan just flagged keyv and now I'm rotating every secret. Who else is dealing with this?
Terrifying that keyv-mongo hit our staging. Did npm audit catch everything or did you find other gaps?
DNS exfiltration is a nightmare. Which DNS-level monitoring tools are you using to stop this?