Malicious code in chai-as-decrypted (npm)
--- _-= Per source details. Do not edit below this line.=-_ ## Source: amazon-inspector (3ed93b06c95c42e3183b89e5fb1d9dea3f711bb20d766861c8d16b8d17f17cc9) Package name `chai-as-decrypted` mimics the popular `chai-as-promised`, and the README impersonates `pino` (uses pino's npm badges and links to github.com/pinojs/pino). On `npm install`, the `postinstall` hook runs `npm run smoke:pino` → `node./index.js`, whose top-level `runBackgroundTask()` spawns a detached `node lib/initializeCaller.js`. That file shadows the global `process` with a local object whose `env.DEV_API_KEY` is a base64 string; it `atob`-decodes the value to https://www.ipregionchecker.org/api/ip-check-encrypted/3aeb34a37, POSTs to it via axios, and executes the HTTP response body with `new Function.constructor("require", response)(require)` — arbitrary remote JavaScript run with full `require` access on the installer's machine, retried 5 times. The base64 hiding of the endpoint and headers behind a fake `process.env` has no legitimate purpose and is solely to evade static scanners. This is a deliberate install-time remote code execution attack against developers who mistype `chai-as-promised`. ## Source: ghsa-malware (4247d01c68df5aa81cfd5bf2bec45101bd522f079f6c9ca5289e7541fc53e198) 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.
AI Analysis
Technical Summary
The 'chai-as-decrypted' npm package mimics the popular 'chai-as-promised' package and uses a README that impersonates the 'pino' package to appear legitimate. Upon installation, its postinstall hook runs a script that spawns a background task which shadows the global process object to hide a base64-encoded URL. It then POSTs to this URL and executes the returned JavaScript code with full require access, allowing arbitrary remote code execution on the victim's machine. This behavior is a deliberate install-time remote code execution attack designed to compromise developers who mistakenly install this malicious package. The obfuscation of the endpoint and headers is intended to evade static scanners. The package version 4.2.8 is affected.
Potential Impact
Installing this package results in arbitrary remote code execution on the installer's machine with full access to Node.js require functionality. This can lead to complete system compromise, including theft or manipulation of secrets, credentials, and other sensitive data. Because the malicious code runs during installation, the attacker gains immediate control, and the system should be considered fully compromised. Removing the package alone does not guarantee removal of all malicious artifacts or backdoors.
Mitigation Recommendations
No official patch or fix is available for this malicious package. The recommended mitigation is to immediately remove the 'chai-as-decrypted' package if installed. Treat any affected system as fully compromised and rotate all secrets and keys from a separate, trusted system. Exercise caution to avoid installing similarly named or impersonating packages. Use verified package sources and consider implementing stricter package name validation or allowlisting to prevent installation of typosquatting or malicious packages.
Malicious code in chai-as-decrypted (npm)
Description
--- _-= Per source details. Do not edit below this line.=-_ ## Source: amazon-inspector (3ed93b06c95c42e3183b89e5fb1d9dea3f711bb20d766861c8d16b8d17f17cc9) Package name `chai-as-decrypted` mimics the popular `chai-as-promised`, and the README impersonates `pino` (uses pino's npm badges and links to github.com/pinojs/pino). On `npm install`, the `postinstall` hook runs `npm run smoke:pino` → `node./index.js`, whose top-level `runBackgroundTask()` spawns a detached `node lib/initializeCaller.js`. That file shadows the global `process` with a local object whose `env.DEV_API_KEY` is a base64 string; it `atob`-decodes the value to https://www.ipregionchecker.org/api/ip-check-encrypted/3aeb34a37, POSTs to it via axios, and executes the HTTP response body with `new Function.constructor("require", response)(require)` — arbitrary remote JavaScript run with full `require` access on the installer's machine, retried 5 times. The base64 hiding of the endpoint and headers behind a fake `process.env` has no legitimate purpose and is solely to evade static scanners. This is a deliberate install-time remote code execution attack against developers who mistype `chai-as-promised`. ## Source: ghsa-malware (4247d01c68df5aa81cfd5bf2bec45101bd522f079f6c9ca5289e7541fc53e198) 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.
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The 'chai-as-decrypted' npm package mimics the popular 'chai-as-promised' package and uses a README that impersonates the 'pino' package to appear legitimate. Upon installation, its postinstall hook runs a script that spawns a background task which shadows the global process object to hide a base64-encoded URL. It then POSTs to this URL and executes the returned JavaScript code with full require access, allowing arbitrary remote code execution on the victim's machine. This behavior is a deliberate install-time remote code execution attack designed to compromise developers who mistakenly install this malicious package. The obfuscation of the endpoint and headers is intended to evade static scanners. The package version 4.2.8 is affected.
Potential Impact
Installing this package results in arbitrary remote code execution on the installer's machine with full access to Node.js require functionality. This can lead to complete system compromise, including theft or manipulation of secrets, credentials, and other sensitive data. Because the malicious code runs during installation, the attacker gains immediate control, and the system should be considered fully compromised. Removing the package alone does not guarantee removal of all malicious artifacts or backdoors.
Mitigation Recommendations
No official patch or fix is available for this malicious package. The recommended mitigation is to immediately remove the 'chai-as-decrypted' package if installed. Treat any affected system as fully compromised and rotate all secrets and keys from a separate, trusted system. Exercise caution to avoid installing similarly named or impersonating packages. Use verified package sources and consider implementing stricter package name validation or allowlisting to prevent installation of typosquatting or malicious packages.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- MAL-2026-5900
- Osv Schema Version
- 1.7.4
- Aliases
- ["GHSA-w7rc-qq2w-vqhg"]
- Ecosystems
- ["npm"]
- Database Specific Severity
- null
- Cvss Version
- null
Threat ID: 6a4c342c27e9c797195fa58d
Added to database: 07/06/2026, 23:03:08 UTC
Last enriched: 07/06/2026, 23:23:56 UTC
Last updated: 07/18/2026, 17:27:21 UTC
Views: 5
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
External Links
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.