Supply-chain threat intelligence

Incident detail

criticalnpm·maintainer compromise·osv

Malicious code in chai-as-assured (npm)

chai-as-assured

Risk score

92

AI summary

Indexed incident for chai-as-assured (npm).

Description

chai-as-assured impersonates the popular chai-as-promised package (matching README, author, and API surface). When the exported plugin function is invoked under normal usage, an async IIFE in the plugin body base64-decodes a hardcoded URL (https://amethyst-lorrin-26.tiiny.site/index.json), performs an axios.get against that anonymous third-party host with a disguised header, and executes the response's cookie field as JavaScript via new Function.constructor('require', response)(require). The fetched payload runs with full Node module privileges (filesystem, network, child_process, etc.) because require is passed in. The C2 URL, header name (x-secret-key), and header value are concealed as base64 strings inside a fake local process.env object (DEV_API_KEY / DEV_SECRET_KEY / DEV_SECRET_VALUE) that shadows Node's global to evade casual source review. The combination of name-confusion against a top-100 chai ecosystem package, deliberate obfuscation of attacker infrastructure, an unpinned anonymous tiiny.site host, and dynamic execution of the fetched response with require is an unambiguous remote-code-execution dropper targeting any project that installs and loads this plugin.

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.

Technical details

Affected versions

=7.1.2=6.0.4>=0

Indicators

  • Advisory IDs
    90%
  • affected version=7.1.275%
  • affected version=6.0.475%
  • affected version>=075%

Timeline

  1. Advisory published
  2. Indexed by ThreatPkg

Related incidents