Skip to content
supplychainattack.orgSupply chain attack incident catalog
resolvedcritical

Malicious code in chai-as-bench (npm)

The npm package chai-as-bench is a typosquatting attack masquerading as a chai plugin. It contains a ~4 MB obfuscated payload that executes unconditionally on require(), with stolen code from the pino logger project used as camouflage.

ShareXLinkedInHacker News
Disclosed
Last updated
Blast radius
Developers who mistyped chai-as-promised and installed chai-as-bench instead; scope limited to those who required the package in their projects.
Ecosystems
Attack vectors
Affected entities
  • chai-as-benchnpm package containing malicious obfuscated payload

chai-as-bench is a malicious npm package designed to exploit typos of the legitimate chai-as-promised library. The package falsely presents itself as a chai assertion plugin through its name and manifest description, but contains no actual chai-related functionality.\n\nUpon require(), the package unconditionally loads lib/config.js, which is a ~4 MB obfuscated payload generated by obfuscator.io. The obfuscation includes a 23,890-entry rotating string array, hex-obfuscated identifiers, and control-flow flattening—all hallmarks of a loader/stealer mechanism. The remaining library files (proto.js, multistream.js, transport.js) and LICENSE are copied verbatim from the unrelated pino logger project to serve as camouflage. The index.js file itself only exports a no-op Express-style middleware, providing no legitimate functionality.\n\nThe package metadata includes placeholder GitHub URLs (yourusername) and generic author information (james@abscond.org), further indicating malicious intent. This is a classic supply-chain attack targeting developers who mistype the popular chai-as-promised package name.\n\nThe incident was identified and credited to the OpenSSF malicious-packages repository.

Indicators of compromise

Packages
  • chai-as-bench

Remediation

  • Remove chai-as-bench from all projects immediately
  • Verify that chai-as-promised (the legitimate package) is installed instead
  • Audit project dependencies for other typosquatting or suspicious packages
  • Review any systems where chai-as-bench was installed for signs of compromise
  • Use npm audit and supply-chain security tools to detect similar malicious packages

Sources

  1. GitHub Advisory GHSA-m5h5-5r2r-qw58 · GitHub Advisory Database

Cite this entry

"Malicious code in chai-as-bench (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-bench-npm-8luktk

Suggest a correction

Found an error or have a newer source? Corrections to factual errors take priority over new entries.

  1. 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
  2. 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
  3. 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
  4. 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