New npm Supply Chain Attack Leverages Mirrors for Phishing Hosting

Threat actors are increasingly exploiting the vast infrastructure of the Node Package Manager (npm) and its mirroring services to host malicious HTML pages. These pages are designed to impersonate legitimate security verification processes, most notably Cloudflare’s CAPTCHA, with the ultimate goal of redirecting unsuspecting users to attacker-controlled websites for phishing or malware distribution. This novel approach circumvents traditional supply chain attack vectors that typically aim to inject malware directly into developer environments, instead repurposing trusted platforms as free, validated storage for malicious content.

The initial discovery of this sophisticated technique traces back to July, when security researcher inf0stache brought attention to a compromised npm package named ‘china_airlines.’ This package contained a deceptive HTML page masquerading as a Cloudflare verification screen. Upon interaction, users were redirected to a malicious domain. This finding was further corroborated by IntelFusions, which provided additional analysis of the ‘china_airlines’ incident, highlighting the phishing capabilities of the fake Cloudflare page and its association with what they termed "ClickFix" phishing.

More recently, a comprehensive investigation by OX Security unearthed a broader campaign, identifying a significant number of npm packages, specifically 24, that hosted this identical malicious HTML page. These packages were not only found on the primary npm registry but also distributed across its various mirroring platforms. This widespread distribution underscores the attackers’ strategy to maximize reach and resilience by embedding their malicious content within the widely adopted npm ecosystem.

Evolving Tactics: Beyond Traditional Supply Chain Compromise

Unlike many contemporary npm supply chain attacks, which focus on compromising developer workstations by injecting malware or infostealing tools through vulnerable packages, this current threat operates on a fundamentally different premise. The primary objective of the attackers is not to infect the end-user’s development environment. Instead, they are leveraging the npm registry as a secure and ostensibly trustworthy repository for their malicious HTML payloads.

Hackers abuse npm mirrors to host phishing redirect pages

The critical element enabling this strategy is the functionality of npm mirroring platforms, such as UNPKG and npmmirror. These services are designed to provide faster access to npm packages by caching their contents. Crucially, some of these mirroring platforms allow direct browser access to individual files hosted within npm packages. This feature, when exploited by threat actors, effectively transforms these legitimate developer-centric platforms into free, publicly accessible web hosting services for phishing pages.

OX Security elaborated on this strategic shift, stating, "While the malware is simply a single HTML page inside the npm package, and while downloading it wouldn’t do harm, the threat actor’s use of npm isn’t to infect developers who install it, but to use the registry and its mirrors as a safe, validated storage for the malware." This highlights a sophisticated understanding of how these infrastructure components operate and how they can be manipulated for malicious ends, bypassing the typical security perimeters that might otherwise detect and block direct hosting of malicious content.

The Mechanics of the Attack: HTML as a Redirector

BleepingComputer’s examination of one of the identified malicious packages revealed a minimalistic structure. The package contained only two essential files: an index.html page and a package.json file. The package.json file, standard for npm packages, declared the index.html file as the package’s main entry point. This simple configuration is all that is required to enable the exploit.

When a mirroring platform like UNPKG caches and serves this package, the index.html file becomes directly accessible via a URL. For instance, a URL of the form https://unpkg[.]com/[package-name]@[version]/index[.]html allows the malicious HTML page to be rendered directly in a user’s web browser. The critical implication here is that the malicious content is served from a reputable domain, such as unpkg.com, rather than from an IP address or domain explicitly flagged as malicious. This can effectively circumvent security software, including web filters and endpoint detection and response (EDR) solutions, that might otherwise block access to known malicious websites. OX Security aptly described this as turning npm mirrors into "free frontend hosts for malicious HTML pages and potentially other payloads as well."

Impersonation and Obfuscation: The Cloudflare Deception

The malicious HTML page at the heart of this campaign is meticulously crafted to impersonate a Cloudflare security verification page. It integrates Cloudflare’s legitimate Turnstile CAPTCHA service, a move designed to enhance its credibility and trick users into believing they are undergoing a standard security check.

Hackers abuse npm mirrors to host phishing redirect pages

However, regardless of whether the user successfully completes the CAPTCHA or interacts with the page in any way, the embedded JavaScript code executes. This code is heavily obfuscated, a common tactic used by attackers to evade static analysis and detection. The primary function of this obfuscated script is to redirect the visitor to a different, attacker-controlled website.

Moshe Siman Tov Bustan, the research team lead at OX Security, provided insights into the evolving redirect targets. He informed BleepingComputer that earlier iterations of the campaign, observed in July, redirected users to microcloud[.]homes. By August, the destination shifted to login[.]microsofte[.]live. Intriguingly, some of the earliest redirects identified in July ultimately resolved to the legitimate Microsoft Outlook mail login site (https://outlook.office.com/mail). This suggests an initial phase where the attackers might have been testing the waters or even attempting to leverage the established trust of Microsoft’s domain before moving to more direct phishing.

BleepingComputer’s own testing confirmed that one of the malicious pages hosted via UNPKG still initiated a redirect to the login[.]microsofte[.]live domain. While this specific domain was not active at the time of reporting, its presence indicates a clear intent to host a fake Microsoft login page, a classic phishing technique aimed at harvesting user credentials.

Dynamic Redirection and Evolving Payloads

The threat actors are not static in their approach; they have implemented more dynamic redirection mechanisms. OX Security researchers noted that some packages have adopted a different redirect strategy utilizing api.keyval.org, a legitimate service designed for storing key-value pairs.

In this advanced technique, the malicious JavaScript code retrieves an encrypted value from the api.keyval.org service. This encrypted data is then decrypted within the user’s browser. The decrypted content is a URL, to which the user is subsequently redirected. This method offers significant advantages to the attackers. It allows them to remotely alter the redirection destination without the need to modify or re-publish the npm package itself. This agility enables them to quickly shift targets, adapt to countermeasures, or switch between different malicious objectives.

Hackers abuse npm mirrors to host phishing redirect pages

During OX Security’s research period, the remotely configured destination pointed to the legitimate ChatGPT website. While this might seem benign, the researchers caution that this value can be changed at any moment to redirect users to phishing pages, such as those related to ClickFix, or other malicious destinations. This demonstrates the inherent flexibility and adaptability of this attack vector. The HTML pages hosted via npm mirrors could, therefore, be used to deliver a wide array of malicious content, including phishing pages designed to steal credentials, links to malware downloads, or redirects to other attacker-controlled infrastructure.

Persistence and Broader Implications

A significant concern highlighted by OX Security is the persistence of these malicious packages on mirroring platforms even after they have been removed from the official npm registry. This persistence means that even if npm takes action to remove the malicious packages from its primary repository, users might still be exposed through the cached versions on mirrors. This creates a persistent threat landscape that requires ongoing vigilance and monitoring.

The overarching takeaway from this evolving threat is the ingenuity of attackers in exploiting trusted infrastructure. "Threat actors keep finding and using new and novel techniques not just to deliver malware, but to use legitimate infrastructure to store their payloads and data," concluded OX Security. This sentiment underscores a critical trend in cybersecurity: attackers are increasingly sophisticated in their methods, moving beyond simple malware injection to more insidious forms of deception that leverage the trust inherent in established technological ecosystems.

The implications of this attack are far-reaching. For developers, it highlights the importance of scrutinizing the dependencies they incorporate into their projects, even those that appear harmless. For security professionals, it necessitates a re-evaluation of threat detection strategies to account for malicious content being served from seemingly legitimate domains. The reliance on npm and its mirrors by millions of developers worldwide makes this a significant vector for potential compromise, impacting not just individual users but potentially the broader software development ecosystem.

Recommendations and Future Outlook

In light of these findings, OX Security offers a crucial recommendation: treat direct HTML requests to npm mirror domains with suspicion. While these platforms are essential for the developer community, their open nature for direct file access can be exploited. Security teams and individual developers should consider implementing additional checks or policies to flag or block such direct access requests, especially if they originate from unexpected sources or patterns.

Hackers abuse npm mirrors to host phishing redirect pages

The continued evolution of these attacks suggests that we will likely see further creative exploitation of cloud services, CDNs, and open-source repositories. The trend of using legitimate infrastructure as a covert hosting solution presents a formidable challenge for cybersecurity defenses, demanding continuous adaptation and innovation to stay ahead of evolving threat actor methodologies. The npm ecosystem, a cornerstone of modern web development, remains a prime target, and vigilance will be paramount in safeguarding its integrity and the security of its users.

The Blue Report 2026, which analyzes defenses across millions of simulations, highlights that once attackers gain valid credentials, their ability to evade security measures increases dramatically, with only 37% of their subsequent actions being blocked. This emphasizes the critical need for robust credential management and a multi-layered security approach that extends beyond initial access prevention to encompass post-breach detection and response. The npm attack vector, by potentially leading to credential harvesting, directly feeds into this dangerous post-access phase, making it a threat that demands serious attention from the entire cybersecurity community.

Related Posts

Five Venezuelan Nationals Plead Guilty to ATM Jackpotting Conspiracy

Five Venezuelan nationals have entered guilty pleas for their involvement in a sophisticated conspiracy to defraud automated teller machines (ATMs) through the use of malware, a criminal tactic known as…

Microsoft Warns of TerminalFix Attacks Deploying Reverse Tunnels

A sophisticated new malware campaign, dubbed TerminalFix by Microsoft’s security researchers, is exploiting a novel attack vector that leverages deceptive Cloudflare CAPTCHA prompts to ensnare unsuspecting users and establish deep…

Leave a Reply

Your email address will not be published. Required fields are marked *

You Missed

A British Man’s Viral Walmart Experience Illuminates Transatlantic Consumer Culture Shock

A British Man’s Viral Walmart Experience Illuminates Transatlantic Consumer Culture Shock

Google Launches AI-Powered ‘Google Pics’ to Revolutionize Everyday Design within Workspace and Premium AI Subscriptions

Google Launches AI-Powered ‘Google Pics’ to Revolutionize Everyday Design within Workspace and Premium AI Subscriptions

The TV vs projector value debate isn’t close – here’s why

The TV vs projector value debate isn’t close – here’s why

Adobe Scales Generative Engine Optimization with Integration of Semrush Assets into New Brand Visibility Suite

Adobe Scales Generative Engine Optimization with Integration of Semrush Assets into New Brand Visibility Suite

Google Messages Integrates Live Checklists, Enhancing Collaborative Event and Trip Planning with September Android Drop

Google Messages Integrates Live Checklists, Enhancing Collaborative Event and Trip Planning with September Android Drop

Razer Unveils Prio: A Foldable Mobile Gaming Controller Redefining Portability for On-the-Go Play

Razer Unveils Prio: A Foldable Mobile Gaming Controller Redefining Portability for On-the-Go Play