A Red Hat employee’s GitHub account was compromised, giving an attacker access to one of the most trusted namespaces on NPM — and the ability to push backdoored packages to tens of thousands of developer machines.

By Monday, 32 official Red Hat packages under the @redhat-cloud-services scope had been laced with a credential-stealing worm. The compromised versions were downloaded roughly 80,000 times per week, according to Wiz Research, which detected the attack on June 1. Most, but not all, of the affected packages had been pulled by publication time.

If your organization installed any @redhat-cloud-services package since June 1, security researchers have one word for you: rotate.

How the Attack Worked

The attacker didn’t need to break into NPM itself. Instead, they compromised a Red Hat employee’s GitHub account and pushed malicious “orphan commits” — code changes invisible to normal code review — directly into three RedHatInsights repositories. Those commits contained a GitHub Actions workflow file and an obfuscated script.

When the workflow ran, it requested a short-lived OIDC token from GitHub and used it to publish backdoored package versions through NPM’s trusted publishing system. The packages even carried valid SLSA provenance attestations — the industry’s gold standard for verifying software authenticity — making the malicious versions nearly indistinguishable from legitimate ones.

The attack unfolded in two waves on June 1, according to Wiz: the first at 10:53 UTC, the second roughly three hours later.

What the Malware Does

Each compromised package declares a preinstall script that runs automatically during npm install — before any application code executes and before the developer has any indication something is wrong.

The payload, dubbed “Miasma,” is a 4.2-megabyte JavaScript file buried under four layers of obfuscation: ROT-21 encoding, AES-128-GCM encryption, an obfuscator.io custom string table, and a custom cipher using 200,000-iteration PBKDF2 key derivation. Each layer is designed to defeat a different class of analysis tool.

Once running, Miasma performs a broad credential sweep: GitHub Actions secrets, AWS access keys, GCP and Azure credentials, HashiCorp Vault tokens, Kubernetes service accounts, npm and PyPI publish tokens, SSH private keys, Docker registry credentials, and any .env files it can find. According to StepSecurity, the malware also reads directly from GitHub Actions Runner process memory to extract secrets that never appear in logs — bypassing GitHub’s masking mechanism entirely.

It then encrypts the stolen data and exfiltrates it through GitHub’s own API, making the traffic indistinguishable from legitimate usage.

And it spreads on its own. Using harvested npm tokens, the worm republishes backdoored versions of other packages on compromised accounts, even bypassing two-factor authentication via NPM’s bypass_2fa parameter.

StepSecurity also found the malware installs persistent backdoors in developer tools: a hook in Claude Code that executes attacker code at every session start, and a VS Code task that triggers on folder open. Both survive package removal.

A Growing Campaign

Miasma is the latest variant of “Mini Shai-Hulud,” a supply chain attack framework built by threat group TeamPCP. The same tradecraft hit Bitwarden in April, SAP and PyTorch Lightning the same week, over 160 packages including Mistral and Tanstack on May 12, and Microsoft’s DurableTask on May 19. When TeamPCP published the full source code on GitHub in mid-May, it effectively armed anyone who wanted to run the same playbook.

This variant shifts focus toward cloud identity collection — not just stealing credentials, but enumerating every identity an infected machine can access. Each infection also generates a uniquely encrypted payload, rendering hash-based detection useless across versions.

Why Red Hat Matters

Red Hat is not a random target. Its enterprise Linux and cloud services underpin infrastructure at thousands of organizations — governments, banks, healthcare systems. An NPM package from @redhat-cloud-services carries implicit trust that most open-source packages never earn.

That trust is exactly what made the namespace valuable to an attacker. The supply chain’s weakest link isn’t the code. It’s the assumption that official channels are safe.

Organizations that may have installed affected packages should immediately rotate all CI/CD secrets, cloud credentials, SSH keys, and npm tokens, and audit developer workstations for persistence mechanisms.

Sources