Three malicious npm packages have been discovered targeting JavaScript developers, aiming to steal sensitive login credentials, API keys, and cryptocurrency wallet data. The packages, masquerading as legitimate tools for the popular Bitcoin ecosystem, were uploaded to the public npm registry and silently installed a remote access trojan known as NodeCordRAT upon integration into developer projects.
Security analysts from Zscaler ThreatLabz identified the malicious trio – bitcoin-main-lib, bitcoin-lib-js, and bip40 – in November 2025. These deceptive packages were designed to mimic the names and details of existing components within the bitcoinjs project, making them appear harmless to unsuspecting developers. The successful deployment of these packages allows attackers to gain remote shell and file access on compromised developer workstations, potentially leading to significant data breaches and unauthorized access to sensitive project resources.
Malicious npm Packages Undermine Developer Security
The discovered malicious npm packages represent a sophisticated supply chain attack targeting the development community. By compromising the npm registry, attackers can insert malicious code into widely used libraries, which then disseminates to any project that incorporates them as dependencies. In this specific instance, developers who added bitcoin-main-lib or bitcoin-lib-js to their projects inadvertently triggered a chain reaction. A standard post-installation script would then pull in bip40 as a dependency, activating the NodeCordRAT payload.
NodeCordRAT, written in Node.js, utilizes Discord as its command-and-control (C2) channel. This choice of communication platform allows attackers to efficiently manage compromised systems and exfiltrate stolen data. Once active, the trojan is programmed to actively search for specific data targets on the victim’s machine. These targets include the login databases for the Chrome browser, .env files that frequently store sensitive secrets like API tokens and environment variables, and data files associated with the MetaMask browser extension, a popular tool for managing cryptocurrency wallets.
The primary objective of this attack is to pilfer credentials and highly sensitive project data directly from developers’ machines. The implications of such a breach are far-reaching, potentially exposing proprietary source code, cloud infrastructure credentials, and access to production deployment pipelines. The attackers exploit the trust developers place in the npm ecosystem, a foundational element of modern web development workflows.
Attack Flow and Deception Tactics
Zscaler ThreatLabz analysts observed that the attack flow is meticulously designed to remain undetected. The deception begins with the carefully crafted package names that closely resemble legitimate bitcoinjs modules. This visual similarity allows the malicious packages to evade immediate scrutiny during the package selection process. A typical infection chain involves a developer installing one of the primary malicious packages, which then triggers the execution of a post-installation script.
This script, often concealed within a file named `postinstall.cjs`, serves as the initial loader for the NodeCordRAT payload. The attackers embed deceptive entries within the `scripts` section of the package.json file, presenting them as routine build tasks. For example, entries like:
"scripts": {
"postinstall": "node postinstall.cjs",
"bip40:start": "node postinstall.cjs"
}
would execute the malicious script silently upon installation. This script, in turn, resolves and initiates the bip40 module as a background process, utilizing PM2 to ensure its continuous operation even after the npm installation process concludes.
While the NodeCordRAT payload remains active during the current session, it does not typically survive a full system reboot by default unless specifically configured to do so. However, this short window of opportunity is often sufficient for the attackers to establish a foothold and begin their data exfiltration. Upon activation, NodeCordRAT establishes a connection to a hardcoded Discord server, where it awaits commands such as `!run` or `!sendfile`. Stolen data, including sensitive credentials and screenshots of the compromised system, are then streamed back to the attackers via the same Discord channel.
Broader Implications and Future Outlook
The discovery of these malicious npm packages underscores the persistent and evolving threats within the software supply chain. Developers and organizations must remain vigilant and implement robust security practices to mitigate these risks. This includes meticulously vetting third-party dependencies, employing automated security scanning tools to detect malicious code, and adopting a principle of least privilege for all development and production environments.
The attack flow, as detailed by Zscaler, highlights the critical need for enhanced security within package registries and the importance of developer education regarding the risks associated with open-source software. The reliance on Discord as a C2 channel also points to attackers leveraging readily available and often underestimated platforms for their malicious activities. The immediate next steps for the npm community will likely involve the swift removal of these malicious packages from the registry and further investigation into the author account responsible for their distribution.
Moving forward, the cybersecurity landscape will likely see continued innovation in both attack methods and defense strategies. Developers and security professionals will need to stay informed about emerging threats and adapt their security postures accordingly. The effectiveness of such attacks often hinges on a combination of technical sophistication and social engineering, making awareness and education crucial components of a comprehensive security strategy. The ongoing efforts to identify and neutralize these threats are vital for maintaining the integrity and security of the entire software development ecosystem.

