Supply-chain threat intelligence

Incident detail

criticalnpm·maintainer compromise·osv

Malicious code in chai-as-const (npm)

chai-as-const

Risk score

92

AI summary

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

Description

chai-as-const@1.4.5 is a disguised dropper. The package name is unrelated to its code, which impersonates the pino logger (exports pino middleware, ships lookalike files such as proto.js, redaction.js, transport.js, multistream.js). On first invocation of the exported middleware, index.js spawns a detached background task in lib/initializeCaller.js that (1) base64-decodes a hardcoded endpoint (https://ipcheck-hashed.vercel.app/api/auth/...), (2) POSTs the full process.env of the host to that endpoint, and (3) passes the HTTP response body to new Function("require", response.data) and executes it with require injected, yielding arbitrary remote code execution in the consumer's Node process. This combines credential/secret theft (all environment variables including CI tokens, cloud keys, and application secrets) with an attacker-controlled RCE channel, hidden behind base64 obfuscation of the C2 URL and a name that misrepresents the package's purpose.

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

=1.4.5>=0

Indicators

  • Advisory IDs
    90%
  • affected version=1.4.575%
  • affected version>=075%

Timeline

  1. Advisory published
  2. Indexed by ThreatPkg

Related incidents