Unit 42 Details Shai-Hulud npm Worm’s Credential Theft and Self-Propagation

· Original article ↗

Summary

Unit 42 analyzes a malicious @bitwarden/cli package attributed to a TeamPCP campaign. Its payload harvests developer and cloud credentials, exfiltrates them through C2 and GitHub, and backdoors npm packages to spread.

Key points

  • The analyzed @bitwarden/[email protected] package uses a preinstall hook and a secondary command trigger to run its payload.
  • The malware targets developer files, environment variables, GitHub Actions secrets, and secrets in AWS, Azure, and Google Cloud.
  • It encrypts stolen data for HTTPS delivery to audit.checkmarx[.]cx and uses public GitHub repositories as a secondary exfiltration path.
  • With stolen npm tokens, the worm modifies publishable packages to add a preinstall hook and republishes them, enabling further spread.
  • The payload can inject a GitHub Actions workflow to collect repository secrets, then remove the branch and workflow run.
  • Unit 42 recommends rotating exposed credentials, auditing packages and GitHub workflows, blocking listed indicators, and pinning dependencies.

Article Details

Attack Vectors
  • The malicious @bitwarden/[email protected] package runs a payload through its preinstall lifecycle hook; its bw_setup.js binary provides a second execution path when the bw command is invoked.
  • The package downloads Bun v1.3.13 and uses it to run the obfuscated bw1.js payload.
  • The payload harvests credentials and secrets from developer files, environment variables, GitHub CLI and Actions contexts, and accessible AWS, Azure, and Google Cloud secret stores.
  • Using stolen npm tokens with publish permissions, the worm modifies and republishes packages with a preinstall hook that triggers further propagation.
  • The malware exfiltrates encrypted data to an HTTPS C2 and to public GitHub repositories created under victims’ accounts.
  • With GitHub tokens having repo and workflow scopes, the malware injects a workflow that collects repository secrets, retrieves the resulting artifact, and deletes the branch and workflow run.
Defensive Notes
  • Block the listed C2 domains and IP addresses at the network perimeter.
  • Rotate potentially exposed npm tokens, GitHub PATs, cloud credentials, SSH keys, and CI/CD secrets.
  • Audit maintained npm packages for unauthorized version changes and preinstall hooks; review GitHub for unexpected repositories, workflows, and artifact downloads.
  • Hunt for unexpected Bun execution and outbound connections to the listed infrastructure.
  • Pin dependencies with lockfiles and integrity hashes; use npm ci and consider disabling lifecycle scripts.
  • Use a private registry or proxy, apply cooldown periods to newly published package versions, and restrict CI/CD egress to approved destinations.

Indicators of compromise

TypeIndicatorContext
DOMAINaudit[.]checkmarx[.]cxC2 domain used for encrypted HTTPS credential exfiltration.
DOMAINcheckmarx[.]cxDomain identified in the article as attacker-controlled infrastructure.
EMAILhelloworm00@proton[.]meEmail address identified in the article as attacker contact information.
IPV491[.]195[.]240[.]123IP address identified in the article as attacker infrastructure.
IPV494[.]154[.]172[.]43C2 IP address associated with the malware.
SHA1bc544f455d7c06c8a1f3446160a6d9a4a8236b11Dead-drop Git commit used by the malware to retrieve C2 configuration.
SHA256167ce57ef59a32a6a0ef4137785828077879092d7f83ddbc1755d6e69116e0adHash of the malicious package.json manifest.
SHA25618f784b3bc9a0bcdcb1a8d7f51bc5f54323fc40cbd874119354ab609bef6e4cbHash of the malicious obfuscated bw1.js payload.
SHA256f35475829991b303c5efc2ee0f343dd38f8614e8b5e69db683923135f85cf60dHash of the malicious bw_setup.js bootstrap script.
URLhxxps[:]//audit[.]checkmarx[.]cx/v1/telemetryC2 endpoint receiving encrypted credential-exfiltration POSTs.
URLhxxps[:]//github[.]com/helloworm00/hello-worldGitHub repository used as a dead-drop source for C2 configuration.

MITRE ATT&CK

Threat Actors

Malware

Vendors

Products

Industries

Related Articles