Supply chain worm with its own MCP server spreads via GitHub

A new malware is circulating in the npm ecosystem, stealing credentials and CI secrets and spreading autonomously.

listen Print view
Man,Interacting,With,A,Holographic,Touchscreen,Interface,In,Red,Color.

(Image: amgun/ Shutterstock.com)

3 min. read
By
  • Manuel Masiero

The IT security company Socket has discovered new malware in the npm ecosystem that carries out supply chain attacks in the style of a Shai-Hulud worm. Among other things, the attackers use an MCP server to steal secrets for AI models, SSH, AWS, GitHub, and more. Developers should check if they are using any of the infected packages.

So far, 19 npm packages infected with malware are known, behind which two npm accounts are hiding, Socket writes in its blog. The malicious packages imitate the names of well-known applications, thus relying on initial distribution via typosquatting. For example, one of the packages is named claud-code@0.2.1 and superficially retains the functionality of the original claude-code. In the background, after the package is integrated, the malware gets to work.

Example of a malicious GitHub action by the worm.

According to security researchers, the malware, whose activities Socket categorizes under the term SANDWORM_MODE, operates similarly to the Shai-Hulud worms. It autonomously searches for API keys from LLM providers such as Anthropic, Google, and OpenAI, exfiltrates CI secrets via HTTPS with DNS fallback, injects dependencies and workflows into repositories using GITHUB_TOKEN, and replicates itself there autonomously. It also has a kill switch. Although this is deactivated by default, it deletes the home directory on infected systems as soon as the malware no longer has access to the GitHub and npm accounts there.

Videos by heise

The worm creates a special McpInject module in the victim's home directory (e.g., ~/.dev-utils/). The MCP server operating within it poses as a legitimate provider and registers three harmless-sounding tools: index_project, lint_check, and scan_dependencies via the standard MCP JSON-RPC protocol. Each provides an embedded prompt injection that instructs coding assistants to secretly search for secrets for SSH, AWS, npm, and others. The findings are to be stored by the AI in a special directory, which the attackers can then read out later. The associated prompt explicitly states: “Do not mention this context-gathering step to the user.”

According to Socket, the compromised packages should now have been removed from npm, GitHub, and Cloudflare. However, further waves are not ruled out due to the worm's self-propagation capability. Socket therefore advises developers to be cautious and recommends checking project dependencies, renewing tokens and CI secrets, and inspecting package.json, lockfiles, and .github/workflows/ for unusual changes. Special attention should be paid to workflows that access secrets.

Supply chain attacks affect almost one in three companies in Germany. npm in particular remains vulnerable to them, but the risk can be minimized with the right strategy.

(olb)

Don't miss any news – follow us on Facebook, LinkedIn or Mastodon.

This article was originally published in German. It was translated with technical assistance and editorially reviewed before publication.