Worm compromises hundreds of popular npm packages | Datadog Security Labs

Worm compromises hundreds of popular npm packages | Datadog Security Labs
A threat actor compromised hundreds of npm packages on August 4, 2026 and used them to distribute a self-propagating backdoor that spreads in ways similar to the Shai-Hulud npm worm. The campaign affected popular packages such as Keyv, Cacheable, and Ecto, and used multiple propagation, exfiltration, and credential-theft paths across npm, GitHub, cloud, and CI environments. #Keyv #Cacheable #Ecto #ShaiHulud

Keypoints

  • The incident began with a malicious commit in the popular keyv npm package repository, followed by similar commits to related projects.
  • The compromised packages were published with a loader and second-stage payload that can execute during installation through a preinstall script.
  • The payload can run under Bun, collect files, environment variables, cloud credentials, GitHub tokens, and CI secrets, and then exfiltrate the data.
  • Propagation can occur through stolen npm tokens, GitHub credentials, or injected workflows and repository modifications.
  • The campaign published malicious versions of multiple Cacheable-family packages, as well as [email protected] and [email protected].
  • The exfiltration logic includes a contract-selected HTTPS endpoint, GitHub-based fallback discovery, and a public GitHub repository fallback for data theft.
  • The article provides SHA-256 hashes and other indicators for the loader, stage-two payload, injected workflow, and token-monitoring components.

MITRE Techniques

  • [T1195.001] Compromise Software Supply Chain – The actor modified npm packages and published malicious versions to spread the payload (‘compromised hundreds of npm packages and used them to propagate a backdoor’).
  • [T1059.004] Command and Scripting Interpreter: Unix Shell – The payload uses shell commands and scripts during execution and collection (‘node setup.mjs through preinstall’, ‘pipelines’, ‘unzip’, ‘sudo python3’).
  • [T1059.006] Command and Scripting Interpreter: JavaScript – The loader and second stage execute JavaScript code under Bun and Node.js (‘The loader synchronously starts Bun’, ‘if (responseBody.code) { await eval(responseBody.code); }’).
  • [T1105] Ingress Tool Transfer – The loader downloads Bun from an official release URL when it is not installed (‘constructs an official Bun release URL’, ‘The downloader uses a node User-Agent’).
  • [T1027] Obfuscated Files or Information – The second stage is heavily obfuscated with Base91 tables, split strings, and flattened state machines (‘Its obfuscation combines a 4,613-entry Base91 string table’).
  • [T1053.005] Scheduled Task/Job: Scheduled Task – The malware installs persistence-like hooks through package scripts and startup hooks in project files (‘preinstall’, ‘.vscode/tasks.json’, ‘.claude/settings.json’).
  • [T1056] Input Capture – The payload searches for and extracts tokens, secrets, and credentials from files and process memory (‘files, environment variables, runner memory, and cloud secret stores are queried’).
  • [T1005] Data from Local System – It reads selected files, environment variables, Kubernetes secrets, and more from the host (‘Full contents of selected files’, ‘entire process.env’).
  • [T1071.001] Application Layer Protocol: Web Protocols – Exfiltration and command retrieval occur over HTTPS (‘makes an HTTPS GET to port 443 on /router’).
  • [T1106] Native API – The code uses system-native behavior and process mechanisms such as detached execution, unref, and memory access (‘respawns its current executable with the same arguments’, ‘reads each readable mapping through /proc//mem’).
  • [T1552.001] Unsecured Credentials: Credentials In Files – It hunts for tokens and secret material in files and histories (‘environment files, shell histories, SSH material, Git, npm, PyPI, cloud, Kubernetes’).
  • [T1098] Account Manipulation – The actor uses valid credentials to create branches, releases, workflows, and package publications (‘uses valid npm or GitHub credentials conditionally’).
  • [T1190] Exploit Public-Facing Application – The injected GitHub workflow and repository abuse paths leverage exposed services and valid tokens to trigger execution (‘creates a workflow’, ‘downloads and reads the artifact’).
  • [T1528] Steal Application Access Token – The malware explicitly looks for npm, GitHub, and cloud tokens and then reuses them for propagation and exfiltration (‘looks for classic GitHub personal access or OAuth tokens’, ‘For each collected token matching npm’s granular-token format’).
  • [T1621] Multi-Factor Authentication Request Generation – The npm propagation path requires bypass_2fa access when checking stolen tokens (‘requires a matching record with bypass_2fa: true’).
  • [T1213] Data from Information Repositories – It queries GitHub, AWS, Kubernetes, Vault, and Actions stores for secrets (‘GitHub REST endpoints for repository and organization Actions secrets’).

Indicators of Compromise

  • [Git commit hashes ] Malicious and related commits in affected repositories – 174f6a5, 893f73f… and other recovered malicious commits
  • [Package names and versions ] Confirmed malicious npm packages and versions – [email protected], [email protected], and @cacheable/[email protected]
  • [Domains / URLs ] Exfiltration and loader infrastructure – https://github.com/oven-sh/bun/releases/download/bun-v1.3.13/.zip, https://:443/router
  • [Ethereum contract / selector ] Smart-contract dead drop used for C2 – 0xE1f2395ee43e45A1556EC6438a88c31B83493103, 0x53ed5143
  • [File names ] Loader, payload, and injected workflow files – setup.mjs, Math_Symbol.js, codeql_analysis.yml
  • [Hashes ] SHA-256 values for recovered artifacts – 9fc2570b7cef51c1b8df116d144d11ff4096357be7d2c4c6367cfc2509cf1bcc, fd3ca4007b225fdf8de7af4345a19179d5efa8c4bb9205f88cda806e5684b1eb, and other listed hashes
  • [Lock file / runtime markers ] Persistence and recursion controls – tmp.dpkg_14527.lock, _NODE_RUNTIME_INIT=1
  • [Token relay / exfiltration markers ] GitHub token abuse markers and fallback repo description – IfYouBlockThisAPIKeyItWillCrashTheLiveProductionServersOfAllThirdPartyClients, Shai-Hulud: Here We Go Again


Read more: https://securitylabs.datadoghq.com/articles/npm-worm-compromises-popular-npm-packages/