Cybersecurity researchers have uncovered a sophisticated malware campaign targeting the npm package repository, which has managed to evade detection and installation defenses. The malicious “indexed-btree” package, discovered by Checkmarx, has been downloaded over 2 million times a week, demonstrating the potential for significant financial gains for attackers.
The campaign’s ingenuity lies in its ability to bypass recent security measures implemented by GitHub to prevent supply chain attacks. In June, GitHub introduced a set of npm security features designed to block dependency lifecycle scripts and prevent automatic retrieval of dependencies from Git repositories or remote URLs without explicit permission. However, the malicious indexed-btree package sidesteps these protections by hiding its loader in the package’s BTree.prototype.set() method, which executes at runtime when the application calls it with a specific key value.
This clever tactic allows the malware to remain undetected during installation and triggers only when the application is actually using the library. As a result, installation appears clean, and none of npm v12’s approval mechanisms are triggered. Once executed, the malware can collect system details and exfiltrate them through hardcoded Slack and Telegram channels.
The researchers note that the threat actors have gone to great lengths to make the project appear legitimate, including building a convincing GitHub repository with a populated commit history and curating a developer account. Furthermore, Checkmarx discovered nine additional npm packages linked to the same operation, which it has now removed from npm. These packages also achieved significant download numbers.
The malware’s architecture is complex, involving an Ethereum smart contract on the Sepolia test network for command-and-control (C2) information and using X25519 key exchange to derive an AES key and decrypt a second-stage payload stored in the contract. When the operators choose to end the attack, the malware can delete its files and remove the malicious trigger from the package code.
The implications of this campaign are significant, highlighting the need for developers to adopt more comprehensive security measures beyond relying on install-time scanning alone. Employing runtime behavioral analysis is crucial to detecting and preventing such attacks. Those who installed indexed-btree or any of the affected packages should rotate all secrets and restore their development environment from a safe backup.
In light of this discovery, it’s essential for developers to build robust security blueprints that account for AI-powered attacks, which can evade traditional detection methods. By staying vigilant and adapting our approach to security, we can better protect ourselves against these sophisticated threats.
Source: Bleeping Computer — 2026-09-20