Executive Overview
The JavaScript ecosystem has once again been rattled by a sophisticated, highly calculated software supply chain campaign targeting the npm (Node Package Manager) registry. Discovered and analyzed by security researchers at Checkmarx, the attack hinges on a malicious package named indexed-btree, which masquerades as a legitimate dependency (sorted-btree). Amassing nearly two million weekly downloads, the package demonstrates an alarming evolution in how malicious actors bypass modern software supply chain security controls.
For years, security tools and package registries have heavily scrutinized the installation phase of software dependencies. Registry maintainers and security vendors have implemented stringent restrictions on lifecycle scripts—such as preinstall and postinstall hooks—which were historically the primary vectors for executing malicious payloads upon package installation. In response, the threat actors behind the indexed-btree campaign have abandoned installation-time scripts entirely. Instead, they have engineered a payload that remains completely dormant during installation, executing only when specific application functions are invoked at runtime.
Compounding the severity of this campaign, the attackers implemented highly resilient infrastructure. Rather than relying on traditional, easily takedown-resistant command-and-control (C2) domains or IP addresses, the malware leverages an Ethereum smart contract deployed on the Sepolia testnet to dynamically fetch instructions. Furthermore, the threat actors deployed an elaborate façade of legitimacy: an authentic-looking GitHub repository complete with realistic commit histories, genuine project structures, and AI-generated avatars to deflect suspicion.
Security experts warn that this campaign marks a pivotal turning point in software supply chain security. As registries successfully harden installation-time defenses, attackers are rapidly adapting, forcing organizations to rethink how they audit dependencies not just when they are installed, but as they execute within production and development environments.
Detailed Chronology and Technical Breakdown
The anatomy of the indexed-btree attack reveals a multi-layered strategy designed to evade both automated static analysis tools and manual code reviews. The operation relies heavily on deception, stealthy execution mechanics, innovative command-and-control architectures, and automated self-cleanup routines.
The Bait: Impersonation and Massive Reach
The threat actor published the malicious package under the name indexed-btree, carefully crafted to mimic sorted-btree, a popular and legitimate JavaScript library used for managing B-Tree data structures. Because developers frequently search for intuitive naming conventions when looking for data structures, the typo-squatting and lookalike naming strategy succeeded in driving massive adoption. Checkmarx noted that the package achieved roughly 2 million weekly downloads, demonstrating how deeply embedded the malicious code became in downstream applications before detection.
Crucially, the attacker bolstered this illusion by establishing a corresponding GitHub repository. Unlike many malicious npm packages that contain empty or hastily thrown-together source code repositories, this repository featured realistic, incremental commits over time. It omitted the malicious code entirely from its public repository view, presenting a clean, functional project. To further humanize the developer persona, the associated GitHub account featured an AI-generated profile photograph, lending an air of authenticity that successfully bypassed casual scrutiny from prospective users and automated vetting bots.
Dormancy at Installation and Runtime Activation
Traditional npm malware relies on package.json lifecycle scripts (preinstall, install, postinstall) to automatically execute shell commands or drop secondary binaries the moment a developer runs npm install or yarn install. Security scanners are naturally tuned to flag packages that attempt execution during these windows.
The indexed-btree campaign completely bypasses this obstacle. According to Checkmarx security researcher Bruno Dias, the package includes no install hooks inside its package.json file. A clean installation of the package results in zero malicious activity, allowing it to slip past static installation-time scanners undetected.
Instead, the malicious payload lies dormant until the application invokes standard data structure methods. Specifically, the malicious code is embedded directly within Btree.prototype.set—a standard method used in JavaScript B-Tree implementations. When a developer’s application instantiates the B-Tree and writes or updates data using the .set() method, the hidden JavaScript code is triggered. This initiates the first stage of the infection lifecycle during regular runtime execution, completely decoupling the attack from the installation phase.
Fingerprinting and Exfiltration
Once triggered during runtime, the obfuscated payload executes a series of environment-profiling tasks. It performs system fingerprinting, gathering granular host information that includes:
- Operating system architecture
- Hostname and local network identifiers
- CPU specifications and core counts
- Available system memory and resource allocations
This telemetry is systematically packaged and exfiltrated to external endpoints controlled by the attacker. Rather than transmitting data to generic web servers, the malware routes the stolen host intelligence directly to hardcoded Slack channels and Telegram chat endpoints, ensuring reliable and instantaneous delivery of victim data to the attackers.
Innovative Command-and-Control (C2) via Ethereum Smart Contracts
Perhaps the most technically novel aspect of the indexed-btree campaign is its C2 infrastructure. Traditional malware relies on hardcoded domain names or IP addresses for command retrieval, making it vulnerable to takedowns by domain registrars, hosting providers, or law enforcement agencies.
To circumvent this vulnerability, the authors of indexed-btree utilized an Ethereum smart contract deployed on the Sepolia testnet—a prominent proof-of-stake testnet widely used by developers to experiment with smart contracts before mainnet deployment.
As Bruno Dias detailed in his research report, the malicious runtime code polls getter and setter functions exposed by the Sepolia smart contract instead of querying a traditional web server or DNS record. The smart contract acts as an immutable, decentralized pointer. If law enforcement or security researchers manage to flag or block an underlying resource, the attacker simply updates the smart contract pointer to direct the malware to a new address. This decentralized architecture renders the C2 channel significantly more resilient against traditional takedown efforts.
Self-Eradication and Evidence Erasure
To minimize the window of forensic opportunity and evade detection by host-based endpoint detection and response (EDR) agents or vigilant developers, the malware includes an automated cleanup routine. After successfully executing its fingerprinting, exfiltration, and C2 synchronization tasks, the code systematically deletes its own malware-related files and strips out the trigger mechanisms from the runtime environment. By erasing its tracks, the malware drastically reduces the likelihood of post-infection discovery.

Supporting Context & Metrics
The indexed-btree incident does not exist in a vacuum; it represents a major escalation in an ongoing wave of software supply chain attacks hitting the JavaScript and npm ecosystems. Understanding the broader context requires examining the sheer volume of supply chain threats and the financial motivations driving these operations.
Scale of the Threat Landscape
The npm registry, as the largest package ecosystem in the world, remains a primary target for malicious actors due to its deeply nested dependency trees. A single malicious package buried three or four layers deep in a popular framework can instantly compromise thousands of commercial applications, enterprise software stacks, and cloud-native microservices.
Recent months have witnessed an unprecedented surge in supply chain disruptions. In parallel campaigns—such as the fast-moving "Shai-Hulud" attacks and various "flooding dropper" operations—threat actors have inundated npm with millions of malicious downloads and billions of monthly download requests. These campaigns frequently test new distribution methodologies, ranging from typo-squatting and dependency confusion to compromised maintainer accounts and sophisticated runtime droppers.
Financial Gains and Crypto-Drainage
While data exfiltration and corporate espionage are major concerns, financial extortion and direct cryptocurrency theft remain primary incentives for many npm threat actors. Checkmarx estimates that the threat actor operating the indexed-btree campaign successfully amassed approximately 109 ETH—equivalent to roughly $264,963 USD at the time of valuation.
This monetization strategy underscores how deeply crypto-economic incentives have bled into cybercrime. By deploying payloads capable of scanning host environments for crypto-wallets, private keys, and cloud infrastructure credentials, attackers turn compromised developer workstations and continuous integration/continuous deployment (CI/CD) pipelines into lucrative mining and asset-draining operations.
Official Statements and Industry Expert Analysis
The shifting tactics demonstrated by the indexed-btree campaign have elicited widespread commentary from cybersecurity leaders, emphasizing that legacy security frameworks are no longer sufficient for modern software development environments.
Ensar Seker, Chief Information Security Officer (CISO) at SOCRadar, emphasized the adaptive nature of modern threat groups in light of recent defensive improvements made by package registries.
"What makes this campaign particularly important is that it shows attackers adapting almost immediately to stronger software supply chain defenses," Seker stated.
He noted that while npm has successfully improved install-time security by restricting and auditing dependency lifecycle scripts, this campaign forcefully demonstrates that malicious actors can easily circumvent these barriers by relocating execution into seemingly legitimate runtime functionality.
"A clean installation no longer leads to a clean dependency," Seker warned.
He elaborated that modern software supply chain security must transcend traditional perimeter checks, such as evaluating package reputation scores or relying solely on installation-time vulnerability scans. Instead, security teams must evolve their toolsets to encompass deep dependency provenance verification, real-time anomaly detection for unexpected code changes, continuous runtime behavioral monitoring, and stringent analysis of outbound network connections originating from application dependencies.
Seker encapsulated the overarching philosophical challenge facing the cybersecurity community:
"The broader lesson is that security controls change attacker behavior rather than eliminate the underlying threat."
Future Outlook & Recommendations for Defense
The emergence of runtime-triggered malware leveraging decentralized C2 mechanisms signals a critical turning point for application security. As npm and other package registries continue to clamp down on installation-phase anomalies, attackers will increasingly pivot toward runtime execution vectors, steganography, and decentralized infrastructure.
To defend against this evolving threat paradigm, organizations must transition from a reactive posture focused primarily on static vulnerability databases to a proactive, holistic runtime defense strategy.
Key Recommendations for Security Teams and Developers:
- Implement Runtime Application Self-Protection (RASP): Organizations should deploy RASP solutions and behavioral monitoring tools capable of detecting anomalous network requests, unexpected file system modifications, or unauthorized data exfiltration attempts originating from third-party libraries during execution.
- Deep-Dive Code Auditing & Provenance Tracking: Relying on automated dependency scanners is no longer enough. Security teams must integrate Software Bill of Materials (SBOM) generation with continuous code review practices, paying close attention to updates in third-party libraries that alter internal prototype methods (such as
Btree.prototype.set). - Strict Outbound Network Governance: Because the malware relies on communicating with external entities (including Telegram, Slack APIs, and Ethereum testnet nodes), enforcing strict egress filtering and Zero Trust network architectures within development and production environments can effectively sever C2 channels.
- Enhanced CI/CD Pipeline Isolation: Development pipelines, CI/CD runners, and developer workstations must be heavily sandboxed and isolated. Limiting environmental variables, restricting access to sensitive credentials, and monitoring container network activity can mitigate the blast radius if a malicious runtime package is inadvertently invoked.
- Continuous Developer Education: Developers must exercise heightened skepticism when selecting third-party packages, prioritizing libraries with established, verifiable maintainer identities, transparent community governance, and rigorous cryptographic provenance verification over those with high download counts alone.
As the software supply chain continues to mature, adversaries will undoubtedly seek out new blind spots. Only through a combination of rigorous runtime oversight, decentralized threat intelligence, and zero-trust engineering can the software development community stay one step ahead of increasingly ingenious supply chain attacks.
