New npm worm steals keys and targets the AI toolchain

Researchers at Socket have uncovered a new variant of an npm supply-chain worm they call Sandworm_Mode. It resembles earlier Shai-Hulud-style malware and infects developer environments, CI workflows and AI toolchains through malicious npm packages using typosquatted names. Once installed, the worm exfiltrates available secrets, including npm and GitHub tokens as well as cryptocurrency keys. It also carries a delayed second stage that activates after roughly 48 hours and continues credential harvesting and propagation. That second stage includes a module called MCPInject, which modifies the configuration of AI coding assistants supporting the Model Context Protocol to add a malicious MCP server, enabling collection of local SSH private keys. At least 19 malicious packages have been identified, and removal work is under way.

What this means for your organisation

Developer machines and build servers often hold access to production, source code and signing keys, making them a shorter path in than the office network. The delayed second stage means an environment can look clean at the moment you check it. What is new is that AI coding assistants have become part of the attack surface: a modified MCP configuration is not something most organisations monitor today. If SSH keys are taken, the attacker moves on with legitimate access.

Berigo recommends

  • Introduce an internal package mirror with approval of new dependencies instead of pulling straight from npm during builds.
  • Rotate npm and GitHub tokens and review which permissions they genuinely need.
  • Bring MCP configuration files into change monitoring, and define which MCP servers are permitted.
  • Require passphrases and hardware-backed storage for SSH keys, and remove long-lived keys from developer machines.

Source

Related services

Security that is understood, governed and works.

Let us help you turn security into an advantage, not a cost. Get in touch for a no-obligation conversation about where your organisation stands and what to prioritise first.

Get in touch