chai-as-repairednpm
Malicious code in chai-as-repaired (npm) Remove it immediately and rotate any exposed credentials.
What this malware does
Package name 'chai-as-repaired' is a 1-edit typosquat of the popular 'chai-as-promised' chai plugin (>1M weekly downloads). The published code is unrelated to the advertised purpose: it ships pino-logger-derived source with mismatched metadata (description='vulnerability management', keywords=['logger','stream']). The exported middleware factory in index.js invokes runJobA, which at lines 32-39 calls spawn('node', [script, JSON.stringify(args)], { detached: true, stdio: 'ignore' }) followed by child.unref() — a detached, output-suppressed child process designed to outlive the parent on every consumer invocation. The spawned script ./lib/caller.js is absent from this version, so the spawn fails silently in 5.32.9, but the loader scaffold is in place. Separately, lib/const.js declares DEV_API_KEY whose value base64-decodes to https://api.jsonstorage.net/v1/json/2ef8c758-a96f-459e-b036-b3b90379a165/a179ea35-b962-4722-b3f1-e28316d1a44a — an anonymous public JSON-store endpoint commonly abused as mutable C2, deliberately named to look like a credential rather than a URL. The combination of typosquat name + purpose/metadata mismatch + detached-child stager + hidden base64-encoded anonymous-JSON-store endpoint is a coherent attack scaffold awaiting the missing payload file.
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
Credential / info stealerFind it
Scan your lockfiles (package-lock.json, pnpm-lock.yaml, yarn.lock, requirements.txt, poetry.lock, etc.) and build artifacts for chai-as-repaired (2 malicious versions). O3 Security's supply-chain scanner checks every dependency against known-malicious package intelligence at install time and in CI, flagging chai-as-repaired across your stack and pipelines.
If you installed it — respond
chai-as-repaired is built to steal secrets, so assume every credential the build or runtime could read is compromised. Remove it from your project and lockfile, then rotate ALL exposed secrets — npm/registry tokens, cloud keys, CI/CD secrets, SSH keys, and any .env values — from a known-clean machine. Audit logs for unauthorized use of those credentials.
Did it already run?
If chai-as-repaired was ever installed, its post-install/runtime payload may have already executed. O3's L7 egress monitoring and runtime eBPF sensors detect the credential exfiltration or command-and-control callback after install and block the malicious outbound channel, so you catch and contain the actual compromise — not just the presence of the package.
How O3 protects you
O3 blocks chai-as-repaired before install through its supply-chain scanner, and if it has already run, detects and severs the exfiltration or C2 callback at runtime through L7 egress monitoring and eBPF.
Frequently asked questions
Campaign
References
Credits
- Amazon Inspector · finder
Detect & block this
O3 blocks chai-as-repaired-class packages before install and in CI — and if it already ran, its runtime egress monitoring catches the credential exfiltration and severs the channel.