CyberSecurityNews

New Shai-Hulud–like npm Worm Attack 19+ Packages to Steal dev/CI Secrets


Shai-Hulud–like npm Worm Attack

A new supply chain worm is actively targeting the npm ecosystem, with a research team identifying at least 19 malicious npm packages designed to steal developer and CI/CD secrets and automatically spread across repositories and workflows.

The campaign, tracked as SANDWORMMODE, uses typosquatted npm packages and poisoned GitHub Actions to infect both developer machines and CI pipelines.

The attackers impersonated popular Node.js utilities and AI coding tools using two npm publisher aliases.

The malicious packages appear normal and keep their expected functionality. However, once imported, they secretly execute a multi-stage JavaScript payload.

Malicious package executes hidden payload( source : socket)
Malicious package executes hidden payload( source: socket)

As soon as a developer runs npm install, the malware activates. It immediately steals sensitive data, including npm and GitHub tokens, environment variables, crypto keys, and other secrets.

In CI environments, the worm bypasses built-in delays, so the full attack, including data theft and propagation, runs instantly. This makes routine dependency installation a major risk point.

google

Shai-Hulud vs SANDWORM_MODE Worm Features:

ThemeEarlier Shai-Hulud WormSANDWORM_MODE Variant
How it spreads (entry point)Used malicious npm packagesUsed fake (typosquat) npm packages that look like real tools
Who it targetsDevelopers and CI systemsSpecifically targets developers and CI; pretends to be trusted packages
When it runsRuns during normal package useRuns when imported, but still works like a normal library
StructureMulti-stage (loader + payload)Multi-stage with encrypted second stage
ObfuscationHides code with runtime tricksUses Base64, compression, XOR, AES encryption to hide payload
What it stealsDeveloper and CI credentialsnpm/GitHub tokens, env secrets, .npmrc creds, password managers
How it sends data outWorks even in restricted networksUses GitHub API, DNS tunneling, and HTTPS endpoints
How it spreads furtherUses stolen npm/GitHub accountsModifies repos, injects package.json, lockfiles, workflows
CI attacksUses CI to spreadInjects malicious workflows and steals secrets
Destructive featureOptional destructive modeWipes home directory if GitHub + npm access are lost
Operator controlConfigurable settingsMany SANDWORM_* environment variable controls
Theme/brandingDune/sandworm namingUses SANDWORM_* themed switches
PersistenceDifferent methodsUses git hooks so new repos inherit infection
Backup spreading methodNot always highlightedUses SSH if API spreading fails
AI tool targetingNot a major focusTargets AI tools (Claude, Cursor, VS Code), injects configs
Self-rewritingNot emphasizedCan rewrite itself using local Ollama (if enabled)

How the Worm Steals Data

The attack works in multiple stages:

StageActivityDetails
Stage 1 – Fast Secret HarvestingInitial Data TheftScans .npmrc files, environment variables, configuration files, and crypto wallets.
Stage 1 – Fast Secret HarvestingExfiltrationSends discovered secrets to a remote server via a Cloudflare Worker endpoint.
Stage 2 – Deep HarvestingExtended Data CollectionSearches password managers, local SQLite databases, and wallet files for additional sensitive data.
Stage 2 – Deep HarvestingExfiltration MethodTransfers stolen data over HTTPS, with DNS tunneling as a fallback method.

The worm uses stolen npm and GitHub credentials to continue spreading. If GitHub API access fails, the malware switches to an SSH fallback method.

It abuses the victim’s SSH agent to clone repositories, insert the carrier dependency, and push changes under the victim’s identity.

The campaign also includes a weaponized GitHub Action called ci-quality/code-quality-check. It pretends to run a normal quality check but actually steals CI secrets and continues the propagation process.

GitHub repo ci-quality/code-quality-check mimics a Node.js code quality Action( source : socket)
GitHub repo ci-quality/code-quality-check mimics a Node.js code quality Action( source : socket)

Supply Chain Worm Propagation Methods:

ActionDescription
Credential AbuseUses stolen npm and GitHub credentials to continue spreading.
Package RepublishingRepublishes infected versions of popular packages.
Carrier InjectionAdds a hidden “carrier” dependency into accessible repositories via the GitHub API.
File ModificationAlters package.json and lockfiles to include malicious changes.
Workflow InjectionAdds malicious GitHub workflows to compromised repositories.
Auto-Merge AttemptsTries to auto-merge pull requests to make changes appear legitimate.

The worm also targets AI coding tools. It installs a rogue MCP server into configurations for tools like Claude Code, Cursor, and VS Code extensions.

It uses hidden prompt injection instructions to trick AI assistants into reading SSH keys, cloud credentials, and tokens, then sending them to the attacker’s server.

It even checks for API keys from multiple major LLM providers, turning infected systems into large-scale credential harvesting platforms.

The sample includes a disabled “dead switch” feature that could wipe a user’s home directory if the attack fails. Although not active, it shows the malware is still evolving.

The Sockets Threat Research Team urges teams to remove malicious packages, rotate secrets, audit workflows, and monitor for suspicious activity, warning that the campaign poses a serious risk to dev and CI environments.

Follow us on Google News, LinkedIn, and X for daily cybersecurity updates. Contact us to feature your stories.

googlenews



Source link