
Executive Summary
The recent npm malware campaign centered around the 'indexed-btree' package has raised significant concerns regarding vulnerabilities in supply chain security. Threat actors have successfully circumvented established defenses by embedding malicious code within normal runtime behavior, rather than relying on installation scripts. This article explores the technical aspects of the attack, the affected environments, and the necessary steps for mitigation.
What Happened
Researchers from Checkmarx have identified a malicious npm package named 'indexed-btree' that masquerades as a legitimate library. With over 2 million weekly downloads, this package has become a vector for malware, enabling attackers to collect sensitive system information and communicate with command-and-control servers.
The 'indexed-btree' package cleverly avoids detection by not using traditional installation scripts, which are typically monitored for malicious activity. Instead, it hides its malicious loader within the BTree.prototype.set() method, a function that is frequently called during normal operations. This method's execution triggers the loading of the malware without raising any alarms from npm's security measures.
Technical Root Cause
The core of the issue lies in the method of attack. By embedding the malicious code within a commonly used function, the attackers exploit the trust developers place in the npm ecosystem. The malware loader is activated when the application interacts with the package, allowing it to execute without being flagged by npm's security protocols.
Once activated, the malware is capable of gathering detailed system information, such as CPU architecture and hostname, and exfiltrating this data through hardcoded channels like Slack and Telegram. Furthermore, it polls an Ethereum smart contract for additional commands, showcasing a sophisticated approach to maintaining control over compromised systems.
Exposure and Affected Environments
The 'indexed-btree' package, along with nine other associated packages, has been linked to this campaign. Developers who have integrated these packages into their projects are at risk, particularly those who rely solely on install-time scanning for security. The attack has implications beyond individual developers, as it threatens the integrity of the broader open-source ecosystem.
Organizations that utilize npm packages for development must be vigilant, as the potential for widespread compromise exists. The attack's success underscores the need for enhanced security measures that extend beyond traditional installation script monitoring.
Patch and Mitigation Playbook
To mitigate the risks associated with the 'indexed-btree' package and similar threats, organizations should adopt the following measures:
- Implement Runtime Behavioral Analysis: Shift focus from solely install-time scanning to runtime analysis to detect unusual behavior in packages.
- Rotate Secrets: For those who have installed the 'indexed-btree' package, it is critical to rotate all secrets and credentials immediately.
- Backup Restoration: Restore development environments from secure backups to eliminate any potential malware.
- Monitor Dependencies: Regularly audit and monitor all npm packages in use to identify any suspicious activity or changes.
- Educate Developers: Provide training on recognizing potential threats and understanding the importance of supply chain security.
Security Program Lessons Learned
This incident highlights several key lessons for organizations:
- Trust but Verify: Even well-established libraries can harbor hidden threats. Continuous verification is essential.
- Layered Security: Employ multiple layers of security, including both static and dynamic analysis tools.
- Community Awareness: Stay informed about emerging threats within the developer community to adapt security practices accordingly.
“The malware loader hides inside the library's own BTree.prototype.set method, which is the main function that every user would call constantly.” - Checkmarx
Sources
- Malicious npm packages evade install-script defenses at runtime
- North Korean WaterPlum hackers infected 30,000 devices worldwide
- Gyazo server flaw exploited to steal 23.6 million user records
An analysis of the ongoing npm malware campaign involving the 'indexed-btree' package, highlighting its evasion of security measures and the implications for developers.
become a vector for malware, enabling attackers to collect sensitive system information and communicate with command-and-control servers. The 'indexed-btree' package cleverly avoids detection by not using traditional installation scripts, which are typically monitored for malicious activity. Instead, it hides its malicious loader within the BTree.prototype.set() method, a function that is frequently called during normal operations. This method's execution triggers the loading of the malware without raising any alarms from npm's security measures. Technical Root Cause The core of the issue lies in the method of attack. By embedding the malicious
This report consolidates available public details and highlights where evidence is still limited, helping teams prioritize immediate defensive action while additional technical indicators are collected.
Operational Security Context
code within a commonly used function, the attackers exploit the trust developers place in the npm ecosystem. The malware loader is activated when the application interacts with the package, allowing it to execute without being flagged by npm's security protocols. Once activated, the malware is capable of gathering detailed system information, such as CPU architecture and hostname, and exfiltrating this data through hardcoded channels like Slack and Telegram. Furthermore, it polls an Ethereum smart contract for additional commands, showcasing a sophisticated approach to maintaining control over compromised systems. Exposure and
Affected Environments The 'indexed-btree' package, along with nine other associated packages, has been linked to this campaign. Developers who have integrated these packages into their projects are at risk, particularly those who rely solely on install-time scanning for security. The attack has implications beyond individual developers, as it threatens the integrity of the broader open-source ecosystem. Organizations that utilize npm packages for development must be vigilant, as the potential for widespread compromise exists. The attack's success underscores the need for enhanced security measures that extend beyond traditional installation script monitoring.
Based on observed patterns in recent campaigns, the likely attacker objective is to establish durable access, exploit trust relationships, and later pivot toward higher-value systems. Where specific attribution or tooling data is absent, these details are not publicly disclosed and should be treated as unknown.
SOC Detection and Triage Workflow
Patch and Mitigation Playbook To mitigate the risks associated with the 'indexed-btree' package and similar threats, organizations should adopt the following measures: Implement Runtime Behavioral Analysis: Shift focus from solely install-time scanning to runtime analysis to detect unusual behavior in packages. Rotate Secrets: For those who have installed the 'indexed-btree' package, it is critical to rotate all secrets and credentials immediately. Backup Restoration: Restore development environments from secure backups to eliminate any potential malware. Monitor Dependencies: Regularly audit and monitor all npm packages in use to identify any suspicious activity
or changes. Educate Developers: Provide training on recognizing potential threats and understanding the importance of supply chain security. Security Program Lessons Learned This incident highlights several key lessons for organizations: Trust but Verify: Even well-established libraries can harbor hidden threats. Continuous verification is essential. Layered Security: Employ multiple layers of security, including both static and dynamic analysis tools. Community Awareness: Stay informed about emerging threats within the developer community to adapt security practices accordingly. “The malware loader hides inside the library's own BTree.prototype.set method, which is the main function that
every user would call constantly.” - Checkmarx Sources Malicious npm packages evade install-script defenses at runtime North Korean WaterPlum hackers infected 30,000 devices worldwide Gyazo server flaw exploited to steal 23.6 million user records An ongoing npm malware campaign involving the 'indexed-btree' package shows how threat actors bypass supply chain defenses by hiding malicious code in a package's normal runtime behavior rather than in installation scripts. [...] announced a set of npm security measures designed to help prevent supply chain attacks that have shaken open-source ecosystems repeatedly since late 2025.
Security engineering teams should validate exploitability across environments, map exposure by asset criticality, and confirm whether available telemetry can detect pre-compromise reconnaissance, exploitation attempts, and post-exploitation behavior.
Engineering Remediation Checklist
One key security measure is to block dependency lifecycle scripts such as 'preinstall', 'install ', and 'postinstall,' unless explicitly approved. Other measures prevent npm from automatically retrieving dependencies from Git repositories or remote URLs without permission. The malicious indexed-btree package sidesteps these protections by avoiding installation scripts and instead hiding its loader in the package's BTree.prototype.set() method, which executes at runtime when the application calls it with This report consolidates available public details and highlights where evidence is still limited, helping teams prioritize immediate defensive action while additional technical indicators
Organizations with internet-facing systems, third-party integrations, or delayed patch cycles generally carry elevated risk. Internal segmentation gaps can increase blast radius if an attacker obtains initial foothold credentials.
Detection and Monitoring Priorities
- Correlate authentication anomalies with unusual process execution and outbound traffic spikes.
- Alert on privilege escalation events, lateral movement indicators, and unauthorized persistence changes.
- Prioritize monitoring of externally exposed services and high-value identity providers.
- Track integrity changes in scripts, scheduled tasks, startup items, and critical configuration files.
- Hunt for command-and-control beaconing patterns and suspicious use of remote administration tools.
Detection coverage should be validated through tabletop simulation or controlled testing to ensure response teams receive actionable, high-confidence alerts quickly.
Mitigation Checklist
- Patch affected services and validate version levels across all environments.
- Restrict exposed management and service ports to trusted networks only.
- Enable detailed logging and alerting for suspicious process or network activity.
- Harden endpoint controls and isolate high-risk systems until remediation completes.
- Conduct post-remediation validation and document residual risk.
Mitigations should be sequenced by risk: immediately reduce exposed attack surface, then remove persistence opportunities, and finally harden architecture to prevent recurrence.
Incident Response and Recovery Planning
- Establish a clear incident commander and communication cadence across security, IT, and leadership.
- Capture and preserve relevant logs and forensic artifacts before major containment changes.
- Contain compromised accounts and hosts, then execute structured eradication with validation checkpoints.
- Document lessons learned and implement control improvements with owner accountability and timelines.
Recovery should include business continuity planning, legal or regulatory assessment where required, and transparent stakeholder updates based on verified facts.
Validation and Follow-through
are collected. a specific key value. As a result, installation appears clean and triggers none of npm v12's approval mechanisms. "The malware loader hides inside the library's own BTree.prototype.set method, which is the main function that every user would call constantly," explains Checkmarx . "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." Once the malware is executed, it can collect system details, including architecture, hostname, CPU, memory, and uptime, and
exfiltrate the information through hardcoded Slack and Telegram channels. The malware also 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. When the operators choose to end the attack, the malware can delete its files and remove the malicious trigger from the package code to wipe its traces. The researchers note that the threat actors have gone to great lengths to make the project appear legitimate,
Security leaders should align technical remediation with stakeholder communication, incident readiness, and continuous monitoring to reduce repeat exposure.