chai-test-mocks@1.2.0
Malicious code in chai-test-mocks (npm)
Analysis
This package is published as a chai test-mocks plugin but is a multi-stage remote-code-execution dropper. Its matcher files are mostly legitimate chai code copied as cover, while the main export hides a payload behind pino-style logging configuration. When the exported function runs, it spawns a detached, unref-ed Node subprocess so it keeps running independently of the host process. That subprocess issues an HTTPS GET to a remote endpoint (jsonkeeper[.]com/b/HIECD) with a custom x-secret-key header, reads a field named Cookie out of the JSON response, and executes that string as JavaScript via the Function constructor with access to require -- i.e. arbitrary attacker-controlled code with full Node module access. The fetch-and-execute is retried up to five times and temporarily silences console output around the evaluation to reduce visibility.
- analyzed by
- Leitwacht
- first seen
- Jun 16, 2026, 06:17 PM
- analyzed
- Jun 16, 2026, 06:22 PM
Related advisories
- aillmgen@4.0.2
- chai-plugin-kit@5.8.1
- easyllmai@3.0.1
- ssr-auth-sync@1.6.16
- zgmiai-claude-code@1.0.56
- zetrix-development-utils@1.0.2
- chai-plugin-helper@1.7.3
- nat-ulid@3.0.2
Independently detected by the Leitwacht supply-chain probe. IOCs are defanged. Published CC0. Think this is a mistake? See the dispute policy.