Malicious code in chai-as-testkit (npm)
The npm package chai-as-testkit is a typosquat/impersonation attack delivering obfuscated malicious code that executes on import. The package falsely claims to be a vulnerability management tool but ships pino library files under a different author, with a synthetic stub that loads a 4MB+ obfuscated bundle containing attacker-controlled code.
- Disclosed
- Last updated
- Blast radius
- Any developer or CI system that installed and imported the chai-as-testkit package would execute attacker-controlled code at import time.
- Ecosystems
- Attack vectors
- Affected entities
- chai-as-testkitMalicious npm package impersonating pino logging library
The package 'chai-as-testkit' published to npm is a malicious typosquat impersonating the legitimate pino logging library. The package metadata references vulnerability management, but the tarball contains pino's README, documentation, type definitions, and library tree (proto, levels, transport, worker, redaction modules) attributed to an unrelated author (Robert King, bugs.url jsonspack.com) rather than the real pinojs publisher.\n\nThe package's index.js is a minimal stub that only requires './lib/config', which is a 4,083,409-byte obfuscated single-line bundle. This bundle uses obfuscator.io-style techniques including a rotated hex-escaped string array (~23,953 entries), control-flow flattening, and dead-code insertion. The obfuscated code executes immediately upon import, running attacker-controlled logic inside the developer or CI Node.js process.\n\nThis represents a supply chain attack combining typosquatting (impersonating a legitimate library) with import-time remote code execution. Any developer or CI system that installed and imported this package would have executed arbitrary attacker code in their environment.\n\nThe incident was identified and credited to the OpenSSF malicious-packages project.
Indicators of compromise
- Packages
- chai-as-testkit
Remediation
- Immediately uninstall chai-as-testkit from all development and CI environments
- Audit npm install logs and lock files to identify when the package was installed
- Assume any system that imported this package has been compromised; rotate credentials, review access logs, and scan for persistence mechanisms
- Review and update dependencies to use the legitimate pino package if pino functionality was intended
- Implement package verification and allowlisting policies to prevent installation of typosquatted or suspicious packages
- Monitor npm registry for similar impersonation attempts targeting pino or other popular libraries
Sources
- GitHub Advisory GHSA-4wfj-hpq9-58mw · GitHub Advisory Database
Cite this entry
"Malicious code in chai-as-testkit (npm)." supplychainattack.org, Supply Chain Attack Incident Catalog. Disclosed August 23, 2026; last updated August 23, 2026. https://supplychainattack.org/incident/malicious-code-in-chai-as-testkit-npm-w213rf
Suggest a correction
Found an error or have a newer source? Corrections to factual errors take priority over new entries.
Related incidents
- resolvedcritical
Malicious code in create-coin (npm)
create-coin@20.1.1 on npm contained malicious postinstall code that collected sensitive environment variables, credentials, and host reconnaissance data. The package impersonated an esbuild platform build and exfiltrated data to a hardcoded endpoint.
npmCompromised packageTyposquatting - resolvedcritical
Malicious code in chai-as-soul (npm)
chai-as-soul@2.3.5 is a typosquat of the pino logging library containing malicious code that exfiltrates environment variables (including AWS/GCP/CI tokens) and executes arbitrary remote code on installation.
npmTyposquattingCompromised package - resolvedcritical
Malicious code in @next-fonts/font (npm)
@next-fonts/font is a typosquat package on npm that executes arbitrary attacker-controlled code via a blockchain-mediated C2 channel when its Inter() function is called. The malicious payload is base64-encoded and executed through Node.js spawn or eval, with no legitimate font functionality.
npmTyposquattingCompromised package - containedcritical
Malicious code in neverthrow-core (npm)
neverthrow-core@1.1.2 is a typosquat of the legitimate neverthrow library containing malicious code that executes arbitrary binaries from an unverified Dropbox URL during npm install via a preinstall script.
npmTyposquattingCompromised package