chai-as-staged (npm) · Malicious Code
Affects chai-as-stagedSource GCVE Database
Malicious package : remove chai-as-staged and rotate any secrets on hosts that installed it.
Data as of 12 Sep 2026, 19:16 UTC
Malicious package
Published to npm · OSV MAL-2026-10047
What to do
Remove chai-as-staged from every project, lockfile and image that pulls it in. Treat any host that installed it as compromised: rotate the credentials, tokens and keys it could read, from a clean machine.
Affected software
| Product | Affected | Fixed in |
|---|---|---|
| npmchai-as-staged | Affected
| Fixed in– |
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
Description
The npm package 'chai-as-staged' impersonates the popular 'chai-as-promised' testing library and contains malicious code. When used as documented, it triggers a detached Node.js child process that fetches attacker-controlled JavaScript from a remote server and executes it with full require access. This dynamic code execution is obfuscated using base64 encoding and disguised environment variables, enabling remote code execution on the installer's machine.