Red Hat’s npm Namespace Compromised in a Stealthy Supply Chain Attack
In a serious security breach, the official npm namespace belonging to Red Hat has been hijacked to disseminate malicious packages embedded with backdoors aimed at stealing sensitive credentials from both cloud services and developers. This alarming incident exemplifies an increasingly sophisticated supply chain attack against widely utilized software components.
According to a recent analysis conducted by ReversingLabs, an attacker successfully published malicious versions of 32 separate packages within the @redhat-cloud-services scope on June 1. Notably, this act was executed within a mere 72 seconds. The compromised packages are integral to the Red Hat Hybrid Cloud Console ecosystem, encompassing a variety of functionalities such as UI components, API clients, and build tooling. These packages collectively represent an impressive 9.8 million downloads, marking a significant breach that could affect countless users and organizations.
Critically, this situation involved more than just typical typosquatting or similar tactics often seen in cyberattacks. Here, the hacker took control of a legitimate, established namespace, effectively undermining the trust that developers inherently place in a recognized vendor. By republishing authentic packages infused with hidden malware, the attacker leveraged the very trust developers have built with Red Hat, turning it into a vehicle for malicious activities.
Malicious Code Concealed in Installation Steps
Each of the compromised packages contained an obfuscated preinstall script that was engineered to run automatically during the installation process, preceding any application code from executing. As a result, the potential for exposure was contingent solely on the act of installing or building the package, rather than its usage in a production environment.
Experts from Aikido Security highlighted that the malicious payload is a variant of the notorious Mini Shai-Hulud worm, which they refer to as "Miasma." This malware is designed to harvest sensitive secrets, and ReversingLabs identified that it specifically targeted cloud service provider keys, CI/CD tokens, npm credentials, and other confidential materials stored on a developer’s machine.
Additionally, true to its malicious lineage, the malware actively attempts to propagate itself. Using stolen publishing tokens, it seeks to republish backdoored versions of other accessible packages, thereby expanding the scope of its threat.
The Subversion of Trusted Features
One of the most concerning aspects of this incident is how the packages were published. Researchers from Aikido pointed out that the ill-intentioned releases were pushed using GitHub Actions OIDC tokens. This indicates that the attacker compromised the build pipeline itself, rather than a developer’s individual account.
This detail is significant, given that OIDC-based "trusted publishing" was specifically introduced to enhance security. By replacing long-lived npm tokens with short-lived ones generated during a build process, developers were given an additional layer of protection. However, this incident illustrates a critical vulnerability: if the pipeline is breached, the trust signal associated with OIDC tokens is rendered virtually meaningless.
By the time this activity came under scrutiny and was analyzed, legitimate maintainers had already pushed clean follow-up versions for all 32 affected packages, and the malicious releases were promptly removed from the npm registry. Nevertheless, projects that relied on the compromised versions or executed an install between the time of their release and their removal are now at risk.
Urgent Recommendations for Organizations
Researchers have urged any organizations that installed any of the affected versions to treat their systems as potentially compromised. The payload operates at the time of installation, ensuring that exposure occurs even if the package wasn’t actively used. Therefore, it is crucial for organizations to rotate any exposed credentials.
Additionally, monitoring and auditing CI/CD pipelines for any unexpected publishing activities has become an essential step in safeguarding against similar future incidents.
This incident serves as a stark reminder of the vulnerabilities in supply chains, where trust can be quickly undermined, highlighting the need for heightened vigilance in the management of software dependencies and the integrity of development pipelines. As cyber threats evolve, organizations must adapt and reinforce their security measures to protect against these sophisticated attacks.
