chai-as-staged@6.0.4
Malicious code in chai-as-staged (npm)
Analysis
Package chai-as-staged@6.0.4 is a combosquat of the real chai-as-promised assertion plugin. It ships a trojanized copy of the pino logger codebase with a remote-code-execution payload in lib/initializeCaller.js. When required and the exported middleware function is called, index.js spawns a detached Node.js child process running lib/initializeCaller.js. That script decodes a hardcoded base64 URL (hxxps://amethyst-lorrin-26[.]tiiny[.]site/index[.]json), fetches the remote resource via axios.get() with a custom HTTP header x-secret-key: _, and executes the response body's 'cookie' field as arbitrary JavaScript code via new Function.constructor("require", ...), granting full access to Node.js modules. The detached spawn (stdio:'ignore', unref()) ensures the payload process outlives the parent. C2: amethyst-lorrin-26[.]tiiny[.]site (HTTPS).
- analyzed by
- Leitwacht
- first seen
- Jun 30, 2026, 11:39 PM
- analyzed
- Jun 30, 2026, 11:40 PM
Related advisories
- chai-as-forgeted@9.24.6
- env-config-f281@1.0.0
- web-pool@2.3.5
- sort-btree@2.1.4
- poxios-chain@1.3.5
- npm-scanner@1.0.0
- hex-type@3.0.2
- @solana-js/web3@1.91.3
Independently detected by the Leitwacht supply-chain probe. IOCs are defanged. Published CC0. Think this is a mistake? See the dispute policy.