Socket Details SANDWORM_MODE npm Worm Targeting CI Secrets and AI Toolchains

· Original article ↗

Summary

Socket researchers describe SANDWORM_MODE, a Shai-Hulud-like worm found in at least 19 typosquatting npm packages and a GitHub Action. Its analyzed payload steals developer/CI secrets, propagates through repositories, and injects rogue MCP servers into AI coding tools.

Key points

  • Socket attributes the campaign to at least 19 typosquatting npm packages and a public GitHub Action, associated with the publisher aliases official334 and javaorg.
  • The packages run a staged JavaScript payload on import: crypto-key harvesting can occur before the main stage’s 48–96-hour delay, which the article says is bypassed in CI.
  • The analyzed payload targets developer and CI credentials, wallets, password managers, local data stores, and LLM API keys; stolen npm and GitHub tokens enable package and repository propagation.
  • Propagation includes dependency and workflow injection, an SSH fallback, and persistence through Git hooks configured via the global init.templateDir setting.
  • The worm’s described exfiltration channels are HTTPS to a Cloudflare Worker, uploads to attacker-controlled GitHub repositories, and DNS tunneling with a DGA fallback.
  • The payload injects rogue MCP servers into AI assistant configurations; their tool descriptions contain instructions to collect credentials. The destructive dead switch and polymorphic engine are reported as disabled.
  • Socket says public execution of the GitHub Action outside operator testing is unconfirmed. The article gives conflicting npm package-removal updates; it reports Cloudflare workers were taken down and GitHub infrastructure removed, and advises removing affected packages, rotating credentials, and auditing workflows, hooks, and AI configurations.

Article Details

Attack Vectors
  • Typosquatting npm packages execute a staged worm when imported while retaining expected library functionality.
  • Stolen npm and GitHub tokens enable attempted publication of infected packages and injection of dependencies and secret-harvesting workflows into repositories; an SSH-based fallback attempts repository changes using victim identities.
  • A malicious GitHub Action harvests CI secrets and attempts to propagate through accessible repositories. Socket had not confirmed public propagation through the Action.
  • A rogue MCP server injects instructions into AI coding assistants to collect credentials and pass them to the server for later exfiltration.
Defensive Notes
  • Remove identified malicious packages and node_modules, and rotate affected npm, GitHub and CI credentials.
  • Review dependency manifests, lockfiles and GitHub workflows for unexpected changes; audit global git templates and hook directories.
  • Inspect AI assistant configurations for unexpected mcpServers entries.
  • Restrict CI access to secrets and publishing, prefer OIDC-based trusted publishing, and monitor anomalous publishing and repository changes.
  • The destructive dead switch and polymorphic engine were disabled in the analyzed build.

Indicators of compromise

TypeIndicatorContext
DOMAINfanfree[.]netSecondary domain used for DNS-tunneled exfiltration.
DOMAINfreefan[.]netPrimary domain used for DNS-tunneled exfiltration.
EMAILjavaorg@proton[.]meOperator contact address associated with the malicious package campaign.
EMAILofficial334@proton[.]meOperator contact address associated with the malicious package campaign.
SHA2565440e1a424631192dff1162eebc8af5dc2389e3d3b23bd26e9c012279ae116e4SHA-256 of the decrypted Stage 2 worm payload.
URLhxxps[:]//pkg-metrics[.]official334[.]workers[.]dev/drainCloudflare Worker endpoint used to exfiltrate crypto keys before the Stage 2 delay.
URLhxxps[:]//pkg-metrics[.]official334[.]workers[.]dev/exfilCloudflare Worker endpoint used for HTTPS exfiltration of harvested data.

MITRE ATT&CK

T1005 · Data from Local SystemStage 2 scans local wallet files and SQLite stores, including notes and message databases, for sensitive data.T1027 · Obfuscated Files or InformationPackage loaders conceal payloads using base64, compression and XOR, including chunks disguised as configuration data.T1041 · Exfiltration Over C2 ChannelThe worm posts harvested secrets to its Cloudflare Worker exfiltration endpoints.T1048.003 · Exfiltration Over Unencrypted Non-C2 ProtocolThe worm sends encoded harvested data in DNS queries to its primary and secondary exfiltration domains.T1059.007 · JavaScriptThe npm loaders execute decoded JavaScript using indirect eval or Node's in-memory Module._compile API.T1071.001 · Web ProtocolsThe worm and malicious Action use HTTPS to send harvested secrets to exfiltration infrastructure.T1078 · Valid AccountsThe worm uses stolen npm and GitHub tokens to attempt package publication and repository modification.T1140 · Deobfuscate/Decode Files or InformationThe loader decodes and decrypts the staged payload at runtime, including AES-256-GCM decryption of Stage 2.T1195.002 · Compromise Software Supply ChainTyposquatting npm packages deliver the worm, which can also attempt to publish infected package updates using stolen tokens.T1497.003 · Time Based ChecksStage 2 is delayed by 48 to 96 hours outside CI environments, hindering short-lived sandbox analysis.T1552.001 · Credentials In FilesThe payload reads .npmrc, .env and other configuration files for tokens and cryptographic secrets.T1555 · Credentials from Password StoresStage 2 invokes Bitwarden, 1Password and LastPass CLIs to search for stored secrets.

Threat Actors

Vendors

Products

Related Articles