Malicious code in chai-as-promised-plus (npm)
The npm package chai-as-promised-plus is a typosquat of the legitimate chai-as-promised library that delivers obfuscated malicious code to consumers at require time. The package mimics the legitimate library's name, README, and description but replaces its exports with a 3.5 MB obfuscated JavaScript bundle that executes in the consumer's Node.js process.
- Disclosed
- Last updated
- Blast radius
- Any npm consumer installing chai-as-promised-plus
- Ecosystems
- Attack vectors
- Affected entities
- chai-as-promised-plusMalicious npm package
The malicious package chai-as-promised-plus was published to npm as a typosquat of the widely-used chai-as-promised assertion helper library. The package reuses the legitimate library's README and description to evade detection.
Upon installation and import, the package's main entry point (lib/chai-as-promised-plus.js) defines a legitimate-looking plugin factory but then overwrites module.exports with require('./config/config'). This causes any consumer to load lib/config/config.js instead of the expected assertion helper.
The config.js file contains a 3,546,568-byte single-line obfuscated JavaScript bundle generated by javascript-obfuscator.io. The bundle uses control-flow flattening, a rotated string array decoder, and hex-keyed object literals to conceal its payload. This obfuscated code executes in the consumer's Node.js process at require time, which is the standard attack pattern for typosquat supply-chain compromises.
A legitimate test-assertion helper has no legitimate reason to ship a multi-megabyte obfuscated blob that replaces its exports at load time. The incident was identified and credited to the OpenSSF malicious-packages project.
Indicators of compromise
- Packages
- chai-as-promised-plus
Remediation
- Remove chai-as-promised-plus from all dependencies immediately
- Audit npm install logs to identify any systems that installed this package
- Regenerate any credentials or secrets that may have been exposed on affected systems
- Use the legitimate chai-as-promised package instead
- Implement package name verification and typosquat detection in dependency management workflows
- Consider using npm audit or similar tools to detect known malicious packages
Sources
- GitHub Advisory GHSA-525m-456x-w57c · GitHub Advisory Database
Cite this entry
"Malicious code in chai-as-promised-plus (npm)." supplychainattack.org, Supply Chain Attack Incident Catalog. Disclosed August 10, 2026; last updated August 10, 2026. https://supplychainattack.org/incident/malicious-code-in-chai-as-promised-plus-npm-ytuh5v
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 akamai-sensor (npm)
A malicious npm package named akamai-sensor impersonated Akamai's legitimate sensor_data anti-bot SDK. The package contained hidden JavaScript code concealed using invisible Unicode characters and implemented a dynamic command-and-control channel via a Google Calendar dead-drop, enabling arbitrary code execution on installation.
npmCompromised packageTyposquatting - resolvedcritical
Malicious code in depcruise-wrap-stream-in-html (npm)
depcruise-wrap-stream-in-html@99.9.1 is a malicious npm package that mimics an internal helper of dependency-cruiser. It is a hollow package that downloads and executes arbitrary code from a Google Cloud Storage bucket during installation.
npmCompromised packageDependency confusionTyposquatting - resolvedcritical
Malicious code in @finaxis/common-js (npm)
The npm package @finaxis/common-js was published with a README and keywords copied from lodash v4.18.1, but contained a heavily obfuscated Xelis (XEL) proof-of-work cryptominer instead of lodash functionality. Consumers installing this package would unknowingly run a covert CPU/GPU miner on their systems.
npmCompromised packageTyposquatting - containedcritical
Malicious code in axios-fast (npm)
axios-fast@1.0.1 on npm contains malicious code that exfiltrates environment variables (including AWS credentials, NPM tokens, and GitHub tokens) to an attacker-controlled webhook during package installation. The package typosquats the legitimate axios HTTP client library.
npmCompromised packageTyposquatting