chai-redirectionnpm
Advisory published Updated
chai-redirection is a confirmed malicious npm package (MAL-2026-6995) that executes malicious code on install (malicious versions 0.0.1, 0.0.3, 0.0.4). Do not install it — remove it immediately and rotate any exposed credentials.
Malicious code in chai-redirection (npm)
What this malware does
chai-redirection presents itself as a chai assertion plugin but its main entry (index.js) unconditionally spawns a detached Node child process running lib/caller.js the moment the package is required. caller.js issues an HTTPS GET to https://www.jsonkeeper.com/b/PC5CK (a mutable pastebin-style host) and passes the response body's cookie field to new Function('require', res.data.cookie)(require), executing attacker-controlled JavaScript in the installer's Node process with full require access. A secondary code path builds a URL from lib/config values, and on a 404 response whose body carries a token field, constructs new Function.constructor('require', res.token) and invokes it with require — a second remote-code-execution channel. The advertised chai plugin API (validJWT, safeString, etc.) is a cover story: the loader runs before any exports are used, so merely requiring this package as a chai plugin triggers remote code execution. The mutable pastebin source means today's payload can be replaced with anything at any time without republishing the package.
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.
Malicious versions
Indicators of compromise (SHA-256)
Detection & response playbook
Malicious packageFind it
Search your lockfiles and build artifacts for chai-redirection (3 malicious versions).
If you installed it — respond
Remove chai-redirection from your project and lockfile, then assume any secrets accessible to the build or runtime were exposed: rotate API keys, tokens, and credentials, and audit for unexpected outbound activity or persistence.
Did it already run?
If chai-redirection was installed, its post-install payload may already have run. Removing the package does not undo that — check outbound connections and credential use from the install window onward.
Frequently asked questions
Campaign
References
Credits
- Amazon Inspector · finder
Detect & block this
O3 blocks chai-redirection-class packages before install and in CI — and if it already ran, its runtime egress monitoring catches the malicious outbound activity and severs the channel.