Skip to content
Tech News
← Back to articles

Malicious npm packages evade install-script defenses at runtime

read original get YubiKey 5C NFC Security Key → more articles
Why This Matters

This campaign shows how npm attackers are evolving past newly deployed install-script protections by embedding malicious code in a package's normal runtime execution path instead, making detection far harder for both automated scanners and developers. With 2 million weekly downloads on the impersonating package, the incident highlights how attractive and vulnerable the open-source supply chain remains to sophisticated, profit-driven threat actors.

Key Takeaways
Worth a Look

YubiKey 5C NFC Security Key — Supply chain attacks like this npm malware campaign often start with compromised developer credentials or npm publishing accounts. A hardware security key like the YubiKey adds phishing-resistant two-factor authentication to your npm and GitHub accounts, making it much harder for attackers to hijack your packages or push malicious updates.

See YubiKey 5C NFC Security Key on Amazon → Affiliate link — we may earn a commission on purchases, at no extra cost to you. Product picked by AI based on this article; it is not a tested recommendation.

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.

The package, spotted by Checkmarx researchers, attempts to impersonate the legitimate 'sorted-btree' library and has already amassed 2 million weekly downloads.

The campaign may also have generated significant profits for the attackers, who, according to Checkmarx, use a wallet holding 109 ETH. However, the report does not say those funds came from cryptocurrency theft.

Bypassing latest security measures

In June 2026, GitHub announced a set of npm security measures designed to help prevent supply chain attacks that have shaken open-source ecosystems repeatedly since late 2025.

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 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.

... continue reading