On August 4, 2026, the JavaScript ecosystem faced a significant supply chain disruption involving a malicious worm linked to the keyv package. This is not a simple dependency confusion attack; it is an actively propagating worm that has poisoned hundreds of packages across the npm registry. The payload is insidious: it installs persistence hooks into developer environments, specifically targeting Visual Studio Code (VS Code) and Claude Code to steal credentials and source code.
For security teams, this represents a critical blind spot. While we often monitor runtime application behavior, the initial compromise occurs at the build or development environment level. SafeDep has verified 353 poisoned versions across 79 package names, while other monitoring firms put the footprint significantly higher. Defenders must immediately assume that active development environments sourcing recent npm packages may be compromised.
Technical Analysis
Affected Products & Platforms:
- Platform: Node.js ecosystems (Windows, Linux, macOS)
- Initial Vector:
keyv@6.0.0and subsequent propagated packages within the Keyv and Cacheable namespaces, spreading to unrelated organizations. - Payload: IDE Hooks (VS Code, Claude Code)
The Attack Chain:
- Initial Installation: A developer or CI/CD pipeline runs
npm installon a package containing the malicious code (seeded viakeyv@6.0.0). - Worm Propagation: The malicious package executes scripts that attempt to publish itself to other packages within the environment or registry, expanding its footprint (hence the "worm" designation).
- Payload Execution: The script drops configuration files or extensions into the local
.vscodedirectory or Claude Code configuration folders. - Credential Theft: The hooks intercept sessions, API keys, or source code, exfiltrating them to attacker-controlled infrastructure.
Exploitation Status:
- Confirmed Active Exploitation: Yes. The package versions are live in the registry, and download counts indicate active installation.
- PoC Availability: The source code of the malicious packages is public in the registry for analysis.
Detection & Response
Detecting this threat requires looking for anomalous file system activity initiated by Node.js package managers and auditing for the presence of the specific malicious versions.
SIGMA Rules
---
title: Potential npm Worm IDE Hook Installation
id: 8c4d2e10-1a5f-4c9e-9b0d-2f3e5a6b7c8d
status: experimental
description: Detects Node.js processes modifying VS Code or Claude Code configuration directories, a behavior associated with the Keyv-linked worm planting hooks.
references:
- https://thehackernews.com/2026/08/keyv-linked-npm-worm-poisons-hundreds.html
author: Security Arsenal
date: 2026/08/04
tags:
- attack.execution
- attack.t1059.001
logsource:
category: process_creation
product: windows
detection:
selection_parent:
ParentImage|endswith:
- '\node.exe'
- '\npm.cmd'
selection_target:
TargetFileName|contains:
- '\.vscode'
- '\claude'
selection_file_ops:
Operation|contains:
- 'CreateFile'
- 'WriteFile'
condition: selection_parent and selection_target and selection_file_ops
falsepositives:
- Legitimate developer extension installation via npm scripts (rare)
level: high
---
title: Suspicious Shell Spawn via NPM Postinstall
id: 9f5e3f21-2b6g-5d0f-0c1e-3g4f6b7c8d9e
status: experimental
description: Detects npm or node processes spawning shells (cmd/bash) which is common in malicious postinstall scripts like the Keyv worm.
references:
- https://thehackernews.com/2026/08/keyv-linked-npm-worm-poisons-hundreds.html
author: Security Arsenal
date: 2026/08/04
tags:
- attack.execution
- attack.t1059.003
logsource:
category: process_creation
product: windows
detection:
selection:
ParentImage|endswith:
- '\node.exe'
- '\npm.cmd'
Image|endswith:
- '\cmd.exe'
- '\powershell.exe'
- '\bash.exe'
condition: selection
falsepositives:
- Legitimate build scripts requiring shell access
level: medium
KQL (Microsoft Sentinel / Defender)
// Hunt for Node.js processes modifying IDE directories
DeviceFileEvents
| where Timestamp > ago(3d)
| where InitiatingProcessFileName in ("node.exe", "npm.cmd", "node")
| where TargetFilePath has ".vscode" or TargetFilePath has "claude"
| where ActionType in ("FileCreated", "FileModified")
| project Timestamp, DeviceName, InitiatingProcessFileName, TargetFilePath, SHA256, AdditionalFields
| extend InstalledPackage = tostring(parse_(AdditionalFields).Package)
Velociraptor VQL
-- Hunt for recently modified VS Code hooks potentially planted by npm
SELECT FullPath, Size, Mtime, Mode
FROM glob(globs="/*/.vscode/*")
-- Check if modified in the last 24 hours
WHERE Mtime > now() - 24H
AND FullPath NOT IN ("/root/.vscode", "/home/*/.vscode/extensions")
-- Scan package. files for keyv@6.0.0 dependency
SELECT FullPath, Data.Version
FROM parse_(filename=FullPath)
WHERE FullPath =~ "package."
AND Data.dependencies.keyv == "6.0.0"
Remediation Script (Bash)
#!/bin/bash
# Remediation script for Keyv-linked npm worm
# Checks for keyv@6.0.0 and suspicious postinstall scripts
echo "[*] Auditing node_modules for keyv@6.0.0..."
# Find all package. files recursively
find . -name "package." -type f | while read -r file; do
# Check for keyv dependency at version 6.0.0
if grep -q '"keyv"[[:space:]]*:[[:space:]]*"6.0.0"' "$file"; then
echo "[!] MALICIOUS DEPENDENCY FOUND in: $file"
echo " Recommendation: Delete node_modules and package-lock., update keyv to a safe version."
fi
done
echo "[*] Checking for suspicious postinstall scripts in node_modules..."
# Identify packages with postinstall scripts that reference IDE paths
find ./node_modules -name "package." -type f -exec grep -l 'postinstall' {} \; | while read -r file; do
dir=$(dirname "$file")
if grep -i 'postinstall' "$file" | grep -qiE '\.vscode|claude|hook'; then
echo "[!] SUSPICIOUS POSTINSTALL SCRIPT FOUND in: $dir"
cat "$file" | grep -A 5 'postinstall'
fi
done
echo "[*] Audit complete."
Remediation
- Immediate Dependency Audit: Run
npm auditandnpm ls keyvacross all environments. Identify any instances ofkeyvat version6.0.0. - Clean Build Environments: If
keyv@6.0.0or any unknown version was installed, assume the environment is compromised. Deletenode_modulesfolders andpackage-lock.files. - Update and Reinstall: Update
package.to pinkeyvto a verified, safe version (typically the latest pre-6.0.0 or a patched future release). Reinstall dependencies usingnpm ciornpm install. - Inspect IDE Settings: Manually check VS Code and Claude Code settings for unknown extensions, tasks, or configurations that were not installed by the developer.
- Rotate Credentials: If the compromise is confirmed, rotate all API keys, tokens, and credentials that may have been resident in the environment during the installation of the malicious package.
Related Resources
Security Arsenal Managed SOC Services AlertMonitor Platform Book a SOC Assessment soc-mdr Intel Hub
Is your security operations ready?
Get a free SOC assessment or see how AlertMonitor cuts through alert noise with automated triage.