MAL-2026-10040: Malicious code in chai-as-balanced (npm)
The npm package chai-as-balanced is a malicious typosquat of chai-as-promised that executes attacker-controlled code. It fetches a remote payload from an anonymous, mutable JSON storage service and executes it with full Node.js privileges, allowing arbitrary code execution. The malicious code runs in a detached child process, hiding its activity from the user. This threat affects version 2.2.3 of chai-as-balanced. There is no official patch or remediation guidance provided.
AI Analysis
Technical Summary
chai-as-balanced is a malicious npm package impersonating chai-as-promised and pino. It contains code that defines a fake process.env with a base64-encoded URL pointing to an attacker-controlled JSON storage service. The package fetches a JSON blob containing a 'cookie' field, which is executed via a new Function constructor, granting full Node.js require access. The execution occurs in a detached child process, allowing the malicious payload to run in the background and evade detection. Because the payload is fetched from an anonymous and mutable source, the executed code can change dynamically without new package releases. This enables arbitrary remote code execution for users who mistakenly install chai-as-balanced instead of chai-as-promised and invoke its exported middleware.
Potential Impact
Successful exploitation results in arbitrary remote code execution with full Node.js privileges on the host system. The attacker can execute any code, potentially leading to system compromise, data theft, or further malicious activity. The dynamic nature of the payload source means the attacker can change the malicious code at any time without updating the package, increasing the threat's persistence and unpredictability.
Mitigation Recommendations
No official patch or remediation is currently available. Users should avoid installing chai-as-balanced and verify package names carefully to prevent typosquatting attacks. Since the malicious payload is fetched dynamically, removing the package and replacing it with the legitimate chai-as-promised package is recommended. Monitor dependencies for typosquatting risks and use package integrity verification tools where possible. Patch status is not yet confirmed — check the vendor advisory or trusted security sources for updates.
MAL-2026-10040: Malicious code in chai-as-balanced (npm)
Description
The npm package chai-as-balanced is a malicious typosquat of chai-as-promised that executes attacker-controlled code. It fetches a remote payload from an anonymous, mutable JSON storage service and executes it with full Node.js privileges, allowing arbitrary code execution. The malicious code runs in a detached child process, hiding its activity from the user. This threat affects version 2.2.3 of chai-as-balanced. There is no official patch or remediation guidance provided.
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-as-balanced is a malicious npm package impersonating chai-as-promised and pino. It contains code that defines a fake process.env with a base64-encoded URL pointing to an attacker-controlled JSON storage service. The package fetches a JSON blob containing a 'cookie' field, which is executed via a new Function constructor, granting full Node.js require access. The execution occurs in a detached child process, allowing the malicious payload to run in the background and evade detection. Because the payload is fetched from an anonymous and mutable source, the executed code can change dynamically without new package releases. This enables arbitrary remote code execution for users who mistakenly install chai-as-balanced instead of chai-as-promised and invoke its exported middleware.
Potential Impact
Successful exploitation results in arbitrary remote code execution with full Node.js privileges on the host system. The attacker can execute any code, potentially leading to system compromise, data theft, or further malicious activity. The dynamic nature of the payload source means the attacker can change the malicious code at any time without updating the package, increasing the threat's persistence and unpredictability.
Mitigation Recommendations
No official patch or remediation is currently available. Users should avoid installing chai-as-balanced and verify package names carefully to prevent typosquatting attacks. Since the malicious payload is fetched dynamically, removing the package and replacing it with the legitimate chai-as-promised package is recommended. Monitor dependencies for typosquatting risks and use package integrity verification tools where possible. Patch status is not yet confirmed — check the vendor advisory or trusted security sources for updates.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- MAL-2026-10040
- Osv Schema Version
- 1.7.4
- Aliases
- []
- Ecosystems
- ["npm"]
- Database Specific Severity
- null
- Cvss Version
- null
Threat ID: 6a50baba68715ace43586231
Added to database: 07/10/2026, 09:26:18 UTC
Last enriched: 07/10/2026, 10:20:26 UTC
Last updated: 07/10/2026, 10:20:26 UTC
Views: 3
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.