Mini Shai-Hulud Campaign Hits Red Hat Cloud Services npm Packages
A supply chain attack dubbed 'Mini Shai-Hulud' compromised numerous npm packages, notably within the @redhat-cloud-services namespace. The malicious packages use preinstall hooks to execute an obfuscated loader that decrypts and runs a credential-harvesting payload via the Bun runtime, targeting CI/CD secrets, cloud credentials, and developer tokens for encrypted exfiltration.
Authors: Socket Research Team
Source:Socket
Detection / Huntermodels
What Happened
Attackers published malicious software packages that look like legitimate Red Hat Cloud Services tools. When a developer or automated system installs these packages, hidden code automatically runs and steals sensitive passwords, cloud access keys, and source code tokens. This matters because stolen credentials can allow attackers to access company networks, cloud environments, and code repositories. Organizations should check if they downloaded these specific packages, remove them, and immediately change any passwords or keys that might have been exposed.
Key Takeaways
- Malicious npm packages published under the @redhat-cloud-services namespace execute obfuscated payloads during the preinstall phase.
- The malware decrypts and executes a secondary payload using Bun, downloading the Bun runtime silently if not already present.
- The primary goal is harvesting sensitive credentials, including GitHub Actions secrets, cloud provider tokens, and SSH keys.
- Exfiltration occurs via encrypted HTTPS POST to an abused Anthropic API endpoint, with a fallback mechanism of committing encrypted JSON files to GitHub repositories.
- The malware daemonizes on non-CI systems to maintain persistence and continue scanning developer workstations.
Affected Systems
- Node.js environments
- CI/CD pipelines (especially GitHub Actions)
- Developer workstations installing the affected npm packages
Attack Chain
The attack begins when a victim installs a compromised npm package, triggering a preinstall script that runs an obfuscated JavaScript loader. This loader decrypts an embedded payload using AES-128-GCM, writes it to a temporary file, and executes it using the Bun runtime, which it downloads silently if necessary. Once running, the malware harvests sensitive environment variables, cloud credentials, and SSH keys, and daemonizes on non-CI systems for persistence. Finally, the stolen data is compressed, encrypted, and exfiltrated via HTTPS POST to an abused API endpoint, with a fallback mechanism of committing encrypted JSON files to GitHub repositories.
Detection Engineering Assessment
Required Log Sources
- Process Creation (Event ID 4688 / Sysmon 1)
- File Creation (Sysmon 11)
- Network Connections (Sysmon 3)
Hunting Hypotheses
| Hypothesis | Telemetry | ATT&CK Stage | FP Risk |
|---|---|---|---|
| Consider hunting for node.js processes spawning curl or wget to download files from GitHub releases, particularly the Bun runtime, which is atypical during standard package installations. | Process Creation | Execution | Low |
| If you have visibility into process execution, look for bun run executing scripts from the /tmp directory (e.g., /tmp/p*.js). | Process Creation | Execution | Low |
| Consider hunting for the execution of 'gh auth token' by non-interactive or background processes, indicating potential credential harvesting. | Process Creation | Credential Access | Low |
| Evaluate whether node.js or bun processes are making unexpected outbound network connections to api.anthropic.com during CI/CD pipeline runs. | Network Connections | Exfiltration | Medium |
Control Gaps
- Static code analysis (bypassed by AES-GCM runtime decryption)
- Standard dependency vulnerability scanners (malware is newly published, not a known CVE)
Key Behavioral Indicators
- node spawning curl or unzip
- node spawning bun
- Creation of tmp.0987654321.lock
- Process environment variable __IS_DAEMON set to 1
False Positive Assessment
- Low
Recommendations
Immediate Mitigation
- Verify against your organization's incident response runbook and team escalation paths before acting.
- Search source repositories, lockfiles, and CI logs for the affected package names (e.g., @redhat-cloud-services/*, @jagreehal/workflow).
- If an affected package was installed, isolate the host and preserve logs before attempting remediation.
- Rotate all potentially exposed credentials, including GitHub tokens, cloud provider keys, and SSH keys.
Infrastructure Hardening
- Consider implementing network egress controls for CI/CD runners to block unexpected outbound traffic during dependency installation.
- Evaluate restricting default GitHub Actions token permissions to least privilege.
- Where practical, run dependency installation with lifecycle scripts disabled by default (--ignore-scripts), then allowlist required scripts.
User Protection
- Consider implementing EDR rules to detect anomalous child processes spawned by package managers (e.g., npm or node spawning curl).
Security Awareness
- Educate developers on the risks of typosquatting and namespace confusion in package registries.
MITRE ATT&CK Mapping
- T1059.007 - Command and Scripting Interpreter: JavaScript
- T1027.002 - Obfuscated Files or Information: Software Packing
- T1078 - Valid Accounts
- T1552.001 - Unsecured Credentials: Credentials In Files
- T1552.004 - Unsecured Credentials: Private Keys
- T1562.001 - Impair Defenses: Disable or Modify Tools
- T1105 - Ingress Tool Transfer
- T1048.002 - Exfiltration Over Alternative Protocol: Exfiltration Over Asymmetric Encrypted Non-C2 Protocol
- filenametmp.0987654321.lockLock file created by the malware to prevent duplicate running instances.
- npm_package@redhat-cloud-services/chromeRepresentative malicious npm package used in the supply chain attack.
- sha2560dc06ecdaa63fe24859cfd955053c23245c536e4733480239d14bebf12688e35Hash of the decrypted main payload.
- sha25621b6409a7b84446310daca5409ad6112ac60a1e4bef97736e53fff5f63bfdef4Hash of the malicious package/index.js loader.
- sha25688896d478986d453f5da79b311de39d9b4b1bea95c21af1d8ef181b0f4e52fe9Hash of the malicious @redhat-cloud-services_chrome-2.3.1.tar.gz package.
- sha256ac2a2208e1726e008be6c73dc0872d9bba163319259dff1b62055ac933ca46b6Hash of the decrypted Bun helper script.
- sha256ee262510cb246d2b904991aee7fc61162bdae34463439ec6383bd5356479d362Hash of the malicious package/package.json.
- urlhxxps://api[.]anthropic[.]com:443/v1/apiAbused legitimate API endpoint used as the primary destination for encrypted exfiltration.