Shai-Hulud Returns With Self-Propagating npm Worm Targeting Developer Credentials

The campaign, detected on August 4, 2026, targeted the maintainer of Keyv, a widely used JavaScript key-value storage library.

The scale of the incident is concerning. Keyv recorded more than 600 million downloads last month.

Related packages affected by the maintainer’s ecosystem include flat-cache, with nearly 580 million downloads, cacheable-request with more than 137 million, cacheable with over 30 million, and cache-manager with more than 16 million monthly downloads.

Elastic said its supply-chain monitoring project first alerted its team through Slack at about 5:39 AM EST. At the time of reporting, researchers had identified more than 400 unique compromised npm packages.

The attack uses a self-propagating worm called CHAINDROP. Unlike a typical malicious package that only infects users who install it, CHAINDROP steals npm credentials and uses them to trojanize every package that the compromised maintainer can modify and publish.

Shai-Hulud npm Worm Returns

The infection starts with a malicious preinstall hook added to a package’s package.json file. npm supports lifecycle scripts, and a preinstall hook can execute commands before a package installation completes.

This means the malicious code can run automatically when a developer or build system installs an infected package.

Supply Chain Monitor initial notifications (Source: elastic)
Supply Chain Monitor initial notifications (Source: elastic)

Affected packages contain a dropper script named setup.mjs. It downloads and launches the main payload, which appears as either Math_Symbol.js or math_init.js.

Although the filenames differ, both files share the same SHA-256 hash. Researchers said the naming difference helps distinguish packages compromised directly through the Keyv monorepo from packages infected later by the worm.

The malware targets Linux, macOS, and Windows systems. The dropper checks whether the Bun JavaScript runtime exists on the device.

If Bun is missing, it identifies the host operating system and processor type, downloads Bun version 1.3.13, extracts it, and uses it to run the malicious JavaScript.

It then deletes the temporary Bun directory to reduce evidence of the activity.

Trojanized files (Source: elastic)
Trojanized files (Source: elastic)

The payload is heavily obfuscated and measures about 711 KB. It uses control-flow flattening and Base91 string encoding to make analysis more difficult.

Researchers also found Dune-themed strings, including “mentat,” “lasgun,” “sietch,” and “sandworm,” linking the operation to earlier Shai-Hulud activity.

The campaign also abuses developer tools. In infected repositories, a Claude Code SessionStart hook can run node .claude/setup.mjs when a new Claude session begins.

A malicious VS Code folderOpen task can similarly execute node .vscode/setup.mjs when a developer opens the repository.

With a stolen GitHub App token, the worm can inject these files into up to 50 branches of accessible repositories, Elastic said.

Indicators of Compromise

IOC TypeIndicatorDescription
SHA-2569fc2570b7cef51c1b8df116d144d11ff4096357be7d2c4c6367cfc2509cf1bccMalicious Math_Symbol.js payload
SHA-256fd3ca4007b225fdf8de7af4345a19179d5efa8c4bb9205f88cda806e5684b1eb

Note: IP addresses and domains are intentionally defanged (e.g., [.]) to prevent accidental resolution or hyperlinking. Re-fang only within controlled threat intelligence platforms such as MISP, VirusTotal, or your SIEM.

Detect, investigate, and respond faster with in-browser data inspection from ANY.RUN. Gain complete phishing visibility to strengthen your SOC and reduce MTTR   

Varshini
Varshini
Varshini is a Cyber Security expert in Threat Analysis, Vulnerability Assessment, and Research. Passionate about staying ahead of emerging Threats and Technologies..

Trending News

Related Stories