chai-plugin@4.5.2
Malicious code in chai-plugin (npm)
Analysis
chai-plugin@4.5.2 combosquats the real chai assertion library. The package's main entry point (index.js) spawns a detached, hidden Node.js child process that runs an obfuscated payload (lib/chai/utils/assertion.js). This payload makes an HTTP GET request to a remote URL, downloads a second-stage script, and executes it via new Function(require, ...)(require), giving the attacker arbitrary code execution on the victim's machine. The child process is spawned with detached:true and child.unref() to avoid detection. No install hooks are required — the malware activates immediately when the package is required. The README is a copy of the real chai documentation to appear legitimate.
- analyzed by
- Leitwacht
- first seen
- Jun 15, 2026, 06:29 AM
- analyzed
- Jun 15, 2026, 06:31 AM
Related advisories
- transform-es2015-typeof-symbol@6.24.1
- tradepilot@2.3.3
- totally-safe-util@1.0.1
- toast-react-slider@1.0.0
- texttweak-kit@1.0.0
- textify-kit@1.0.0
- testssdd@1.0.0
- tailwind-scroller@1.0.2
Independently detected by the Leitwacht supply-chain probe. IOCs are defanged. Published CC0. Think this is a mistake? See the dispute policy.