A sophisticated and ongoing malware campaign targeting the npm ecosystem has unveiled a disturbing new tactic employed by threat actors to bypass increasingly robust security measures. The campaign, centered around the ‘indexed-btree’ package, demonstrates a deliberate strategy of embedding malicious code not within traditional installation scripts, but within the normal runtime behavior of a library. This novel approach allows attackers to evade detection by standard security protocols designed to scrutinize the initial setup phase of a software component, raising significant concerns for the integrity of open-source software supply chains.
The compromised package, identified by researchers at Checkmarx, was designed to mimic the functionality of the legitimate ‘sorted-btree’ library. Its widespread adoption is evident in its alarming download statistics, reportedly reaching 2 million weekly downloads. The financial motivations behind this operation appear substantial, with Checkmarx noting a cryptocurrency wallet associated with the campaign holding 109 ETH. While the exact source of these funds remains undisclosed, the presence of such a significant amount suggests a potentially lucrative operation for the perpetrators.
Evolution of Supply Chain Defenses and the ‘Indexed-btree’ Exploitation
The emergence of the ‘indexed-btree’ campaign comes at a time when major platforms are actively strengthening their defenses against supply chain attacks. In June 2026, GitHub announced a series of critical security enhancements for npm, aimed at mitigating the persistent threats that have plagued open-source ecosystems since late 2025. A cornerstone of these new measures was the blocking of dependency lifecycle scripts, such as ‘preinstall’, ‘install’, and ‘postinstall’, unless explicitly authorized by developers. This move was intended to prevent malicious code from executing automatically during the package installation process.
Further bolstering these protections, npm also implemented restrictions against the automatic retrieval of dependencies from Git repositories or remote URLs without explicit permission. These changes represented a significant step forward in securing the software supply chain, addressing a known vector for malware injection.

However, the ‘indexed-btree’ malware campaign has proven adept at circumventing these latest security protocols. Instead of leveraging installation scripts, which are now heavily scrutinized, the attackers ingeniously embedded their malicious loader within the ‘BTree.prototype.set()’ method of the package. This function is an integral part of the library’s core functionality and is routinely called by applications that utilize the package. The malware’s trigger is activated only when this method is invoked with a specific key value, a condition that can easily be met during normal application operation.
"The malware loader hides inside the library’s own BTree.prototype.set method, which is the main function that every user would call constantly," explained Checkmarx in their analysis. "This triggers the sharedLoad.min.js, which contains the obfuscated first stage of the malware. This is a well-built way to sneak past standard taint-analysis tools and most static scanners."
This runtime execution model means that the installation process itself appears entirely benign, bypassing the approval mechanisms introduced with npm v12. Consequently, traditional security tools that focus on the installation phase would likely fail to detect the presence of malicious code.
The Mechanics of the ‘Indexed-btree’ Malware
Once activated through the compromised ‘BTree.prototype.set()’ method, the malware initiates a series of actions designed to gather sensitive system information and establish a covert command-and-control (C2) channel. The initial payload, obfuscated within ‘sharedLoad.min.js’, is capable of collecting a comprehensive range of system details, including the system’s architecture, hostname, CPU specifications, available memory, and system uptime. This information is then exfiltrated through hardcoded communication channels, specifically Slack and Telegram, suggesting a reliance on readily available and often less scrutinized messaging platforms for data leakage.
The malware’s sophistication extends to its command-and-control infrastructure. It actively polls an Ethereum smart contract deployed on the Sepolia test network. This contract serves as a dynamic source for C2 instructions and potentially for the delivery of secondary payloads. The communication between the malware and the smart contract is secured using an X25519 key exchange mechanism, which allows for the derivation of an AES key. This AES key is then used to decrypt a second-stage payload that is also stored within the smart contract. This multi-stage approach provides a layer of indirection and obfuscation, making it more challenging for security researchers to track and disrupt the attacker’s operations.

Furthermore, the threat actors have implemented a self-destruction mechanism. Upon receiving a signal to cease operations, the malware is capable of deleting its own files and removing the malicious trigger from the package code. This feature is designed to erase any evidence of its presence, making forensic analysis and attribution significantly more difficult.
Deception and Deeper Network of Compromise
The success of the ‘indexed-btree’ campaign is underpinned by the meticulous efforts of the threat actors to create a facade of legitimacy. Checkmarx researchers highlighted that the attackers invested considerable time and resources in establishing a convincing GitHub repository. This included populating its commit history with seemingly legitimate development activities and carefully curating the associated developer account to appear credible. Such efforts are crucial for building trust within the open-source community, where developers often rely on the reputation and activity of a project’s maintainers.
The ‘indexed-btree’ package was not an isolated incident. Checkmarx’s investigation uncovered an additional nine npm packages linked to the same malicious operation. These packages, which have also been removed from the npm registry, had also accumulated significant download numbers, indicating a broader and more widespread attack campaign. The interconnectedness of these packages suggests a coordinated effort to infiltrate various parts of the software development ecosystem.
The implications of such widespread compromise are far-reaching. Developers who unknowingly incorporated these malicious packages into their projects could have their systems compromised, their sensitive data stolen, or their applications used as stepping stones for further attacks. The trust inherent in the open-source model, where developers rely on shared components, becomes a critical vulnerability when exploited by malicious actors.
Recommendations and Broader Impact on Software Security
In light of these findings, security experts are strongly advising developers to adopt a more comprehensive approach to securing their software supply chains. The reliance on install-time scanning alone is no longer sufficient. The ‘indexed-btree’ campaign underscores the critical need for runtime behavioral analysis, which monitors the actual execution of code to detect anomalous or malicious activity, regardless of how it was introduced.

For organizations and individuals who may have installed ‘indexed-btree’ or any of the other identified malicious packages, immediate action is imperative. The recommended remediation steps include:
- Rotating all secrets: This includes API keys, passwords, and any other sensitive credentials that may have been exposed.
- Restoring development environments from a safe backup: This ensures that the compromised code is completely removed and replaced with a known-good state.
The ‘indexed-btree’ malware campaign serves as a stark reminder that the threat landscape is constantly evolving. As security measures become more sophisticated, threat actors will continue to seek out novel and innovative ways to exploit vulnerabilities. The move to embed malware within legitimate runtime functions represents a significant escalation in the arms race between attackers and defenders in the open-source software domain. This incident highlights the persistent challenges in securing the complex web of dependencies that underpin modern software development and emphasizes the ongoing need for vigilance, advanced detection techniques, and a proactive security posture from all stakeholders in the software supply chain. The future of open-source security will likely depend on the ability to detect and mitigate threats not just at the point of installation, but throughout the entire lifecycle of a software component.







