The Shai-Hulud npm worm is back. First documented in early 2025, it earned its name by burrowing through the npm registry one legitimate package at a time -- stealing maintainer credentials at install time and using them to republish trojanized versions, each new victim extending the worm's reach. The second wave is broader in scope and more refined in technique: the worm has abandoned pinning bun as an explicit manifest dependency, replacing it with a silent bootstrapper (setup_bun.js) that installs the Bun runtime without leaving an obvious trace in the package manifest. On 2025-11-24, kinvey-cli-wrapper became one of more than a thousand packages targeted in this campaign when version 0.3.1 appeared on npm carrying the injected preinstall hook. Any developer or CI pipeline that resolved this version silently ran the credential harvester.
Key Findings
- Malicious version: v0.3.1, published 2025-11-24 out-of-band; the package's prior release line is clean.
- Entry point: injected
preinstall hook chains setup_bun.js (Bun bootstrapper) and bun_environment.js (payload), firing automatically on npm install with no user interaction.
- Worm mechanics: harvested credentials are used to republish the worm under the victim maintainer's identity, propagating to new packages without any central infrastructure.
- Evolution from wave 1: this wave drops the explicit
bun dependency in package.json -- the clearest wave-1 indicator -- replacing it with a standalone bootstrapper, lowering the detection signal visible in manifest diffs.
- Detection: Script-JS.Worm.ShaiHulud, Text.Worm.ShaiHulud.
Package Background
kinvey-cli-wrapper has been part of the npm ecosystem since 2019-01-31. Supply chain attackers value packages like this not for what they do, but for who maintains them and what registries those maintainers can write to. Compromising a maintainer's npm token during install is the worm's entire business model: one infected developer machine unlocks every package that person maintains.
Attack Analysis
The second wave's hallmark is modularity. Where wave 1 of Shai-Hulud made its Bun dependency explicit in package.json -- a change that stood out immediately in manifest diffs -- this wave delegates runtime installation to a dedicated script, keeping the manifest change minimal and less conspicuous.
setup_bun.js is the bootstrapper. It is byte-for-byte identical (SHA256 a3894003...) across effectively every package in this campaign -- a single, centrally authored component distributed verbatim to over a thousand packages. On execution it silently installs the Bun JavaScript runtime on the victim machine if not already present, ensuring the payload can run regardless of the environment.
bun_environment.js is the payload, executed by Bun immediately after the bootstrapper completes. It is heavily obfuscated using hex-named variables (_0x...) and imports Node's crypto primitives (createHash, pbkdf2Sync, randomBytes). Behavioral analysis reveals credential access, environment variable enumeration, base16 encoding, and network activity -- consistent with exfiltrating npm tokens and other secrets, then using them to sign and publish new worm-carrying releases. Two payload variants circulate across the campaign (62ee164b... in ~93% of packages, f099c5d9... in ~6%), indicating the payload was recompiled or re-obfuscated mid-campaign.
package.json completes the picture. The injected preinstall script is the only visible manifest change -- a one-line addition that chains the two scripts and triggers the entire attack automatically on install.
Malicious Files
setup_bun.js -- Bun bootstrapper. SHA256 a3894003... is constant across the entire campaign: the worm's authors distribute it as a shared component, which makes it an effective campaign-level IOC. Classified Script-JS.Worm.ShaiHulud.
bun_environment.js -- install-time credential harvester. Obfuscated JavaScript payload leveraging crypto primitives with behavioral signals for credential theft, network exfiltration, and evasion. The two observed variants share the same behavioral profile and differ only in obfuscation. Classified Script-JS.Worm.ShaiHulud.
package.json -- weaponized manifest. Contains the injected preinstall hook as its sole modification; the rest of the file is the legitimate package manifest. Classified Text.Worm.ShaiHulud.
Recommendations
- Identify exposure: check whether
kinvey-cli-wrapper v0.3.1 appears in your dependency tree, including transitive dependencies. Any pipeline that ran npm install while this version was current should be treated as potentially compromised.
- Rotate credentials immediately: if
kinvey-cli-wrapper v0.3.1 was installed on a machine, assume all npm tokens, GitHub tokens, and environment secrets present at install time were exfiltrated. Revoke and rotate them before doing anything else.
- Audit your npm publishing history: the worm's goal is lateral propagation. If a compromised token had publish rights to other packages, check those packages' recent release history for unexpected versions.
- Pin to a clean release: remove v0.3.1 from all dependency files and lock to a known-good prior version.
- Scan your supply chain: use Spectra Assure Community at https://secure.software/npm/packages/kinvey-cli-wrapper to check whether any package in your environment has been flagged as part of this campaign.
Indicators of Compromise
Malicious Files
| Filename | SHA256 | Detection |
|---|
| setup_bun.js | a3894003ad1d293ba96d77881ccd2071446dc3f65f434669b49b3da92421901a | Script-JS.Worm.ShaiHulud |
| bun_environment.js | 62ee164b9b306250c1172583f138c9614139264f889fa99614903c12755468d0 | Script-JS.Worm.ShaiHulud |
| package.json | 3b2deec616ea68c497f9e135322388c91bb9694efb43e1b5596b3c645ae8d563 | Text.Worm.ShaiHulud |
Network IOCs
| URL / IP | Purpose |
|---|
| None identified | C2 endpoints are decoded at runtime from the obfuscated payload; no plaintext indicators were recovered |
Archive Hashes
| File | SHA256 |
|---|
| kinvey-cli-wrapper-0.3.1.tgz | 23472fa20c930083103f00d922983c0e639e3e5b5ff2d7773dd25b06bd304be3 |