Malicious code in chai-as-reformed (npm)
The npm package chai-as-reformed is a malicious typosquat of chai-as-promised that executes attacker-controlled code fetched from jsonstorage.net. The package spawns a detached Node.js process that decodes a hardcoded URL, fetches a JSON payload, and executes it with full require() access in the host process.
- Disclosed
- Last updated
- Blast radius
- Any Node.js application that installed the malicious chai-as-reformed package
- Ecosystems
- Attack vectors
- Affected entities
- chai-as-reformedMalicious npm package impersonating chai-as-promised
The chai-as-reformed npm package is a malicious impersonation of the legitimate chai-as-promised library. It copies the README from an unrelated package (pino) to evade detection.
When the package is imported, its exported middleware spawns a detached node lib/caller.js process. The caller.js script base64-decodes a hardcoded URL pointing to jsonstorage.net, along with an x-secret-key header, both concealed within a synthetic process.env object. It then fetches a JSON response from the remote server and passes the cookie field to new Function.constructor("require", s)(require), executing arbitrary attacker-controlled JavaScript in the host Node.js process with full access to the require() function.
The remote payload is mutable and can be changed by the attacker at any time, allowing for dynamic exploitation of all affected installations. This represents a critical supply chain attack vector for any application that installed this package.
The incident was identified and credited to the OpenSSF's malicious-packages repository.
Indicators of compromise
- Packages
- chai-as-reformed
- Domains
- jsonstorage.net
Remediation
- Immediately remove chai-as-reformed from all package.json files and lock files
- Audit npm install logs to identify all systems that may have installed this package
- Regenerate all secrets, credentials, and API keys that may have been exposed to the compromised process
- Review application logs for suspicious activity or unexpected network connections to jsonstorage.net
- Perform a full security audit of affected systems for signs of compromise or data exfiltration
- Use npm audit to check for other malicious packages and typosquats of commonly-used libraries
Sources
- GitHub Advisory GHSA-2mjx-w8vq-qwgp · GitHub Advisory Database
Cite this entry
"Malicious code in chai-as-reformed (npm)." supplychainattack.org, Supply Chain Attack Incident Catalog. Disclosed August 13, 2026; last updated August 13, 2026. https://supplychainattack.org/incident/malicious-code-in-chai-as-reformed-npm-08u5pf
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 - containedcritical
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.
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 - 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