Malicious npm Packages Evade Install-Script Defenses
Threat actors have published a malicious npm package named indexed-btree that evades GitHub’s latest install-script defenses by hiding its payload inside normal runtime behavior. The package has already accumulated more than 2 million weekly downloads, making it one of the largest active supply chain attacks in the open-source ecosystem.
What Happened: Malicious npm Package Hides Loader Inside BTree.set() Runtime Method
The indexed-btree package impersonates the legitimate sorted-btree library and was discovered by Checkmarx researchers on September 20, 2026. The attackers designed the package to appear legitimate, including a fabricated GitHub repository with curated commit history and a well-maintained developer account.
In June 2026, GitHub introduced new npm security measures to block dependency lifecycle scripts unless explicitly approved. Furthermore, npm v12 now prevents automatic retrieval of dependencies from Git repositories or remote URLs without permission. The malicious package sidesteps all of these protections by avoiding install scripts entirely. Instead, it hides its loader inside the package’s own BTree.prototype.set() method, which executes at runtime whenever the application calls it with a specific key value.
Consequently, installation appears clean and triggers none of npm’s approval mechanisms. The malware only activates when the compromised function is called during normal application use. This timing makes static and install-time detection extremely difficult.
Technical Details of the Indexed-BTree Malware Campaign
The attack chain begins when a developer installs the indexed-btree package or one of its related variants. The package contains obfuscated JavaScript inside the BTree.prototype.set() method that loads sharedLoad.min.js as the first stage of the malware.
Once executed, the malware collects detailed system information, including architecture, hostname, CPU, memory, and uptime. Furthermore, it exfiltrates this data through hardcoded Slack and Telegram channels. The malware then polls an Ethereum smart contract on the Sepolia test network for command-and-control (C2) information. It uses X25519 key exchange to derive an AES key and decrypt a second-stage payload stored in the contract.
The attackers can also remotely trigger a cleanup routine. When operators choose to end the attack, the malware deletes its files and removes the malicious trigger from the package code to wipe its traces.
Additional Compromised Packages in the Campaign
Checkmarx identified nine additional npm packages linked to the same operation. These packages also achieved significant download numbers before removal:
- btree-core — 1,951,274 downloads
- btree-leaderboard — 493,685 downloads
- btree-range-store — 468,092 downloads
- ordered-kv-index — 448,184 downloads
- sliding-score-window — 448,024 downloads
- priority-slot-queue — 402,860 downloads
- btree-time-index — 425,312 downloads
- btree-lru-cache — 372,185 downloads
- neighbor-key-map — 366,019 downloads
The threat actors also created a wallet holding 109 ETH, suggesting significant profits from the campaign.
Business and Operational Impact
The indexed-btree campaign carries severe consequences for developers and organizations relying on the npm ecosystem:
- Supply chain compromise: Malicious code entered production applications through a trusted package manager, bypassing standard security gates.
- Credential exposure: System profiling and C2 communication indicate the campaign is designed for data theft and follow-on attacks.
- Development environment contamination: Developers who installed these packages may have compromised their entire toolchain and secrets.
- Trust erosion: The fabricated GitHub repository and commit history demonstrate a new level of sophistication in open-source deception.
- Silent activation: Runtime triggering means the malware can lie dormant until called, making incident response timelines longer and more complex.
Mitigation and Recommendations
Developers and security teams should take immediate action to assess exposure and remediate affected systems.
Immediate Actions for Defenders
- Audit all projects for the
indexed-btreepackage and the nine related packages listed above. - Rotate all secrets, API keys, and credentials from any development environment where these packages were installed.
- Restore compromised development environments from a clean backup rather than attempting in-place cleanup.
- Review npm audit logs and lock files for signs of these packages across CI/CD pipelines.
- Do not rely solely on install-time scanning; implement runtime behavioral analysis for dependency execution.
Long-Term Strategies
Organizations should strengthen their software supply chain defenses to prevent similar attacks. Moreover, teams should adopt dependency pinning and vendoring practices to control exactly what code enters production. Also, runtime application security testing (RASP) and software composition analysis (SCA) tools should be configured to detect anomalous behavior inside legitimate package functions. Finally, establish a process for validating the authenticity of newly published packages before adoption, especially those with rapidly growing download counts.
Bottom line: The indexed-btree campaign proves that install-script blocking alone is no longer enough. Threat actors have moved their payloads into runtime methods, and developers must add behavioral monitoring to their supply chain security programs.
Incident Summary
| Incident: | Malicious npm Package Campaign (indexed-btree) |
| Affected Packages: | indexed-btree, btree-core, btree-leaderboard, btree-range-store, ordered-kv-index, sliding-score-window, priority-slot-queue, btree-time-index, btree-lru-cache, neighbor-key-map |
| Total Downloads: | Over 5.5 million combined |
| Attack Vector: | Runtime payload hidden inside BTree.prototype.set() method |
| C2 Mechanism: | Ethereum smart contract on Sepolia test network via X25519 + AES |
| Disclosure Date: | September 20, 2026 |
| Patch Status: | Packages removed from npm registry by Checkmarx/GitHub |
| Threat Actor Wallet: | 109 ETH held in attacker-controlled wallet |
References
- Checkmarx, “NPM BTree Malware Campaign Affects Millions of Downloads With No Need for Install Script,” September 20, 2026, https://checkmarx.com/zero-post/npm-btree-malware-campaign-affects-millions-of-downloads-no-need-for-install-script/.
- BleepingComputer, “Malicious npm packages evade install-script defenses at runtime,” September 20, 2026, https://www.bleepingcomputer.com/news/security/malicious-npm-packages-evade-install-script-defenses-at-runtime/.