MAL-2026-10047: Malicious code in chai-as-staged (npm)
The npm package 'chai-as-staged' version 6.0.4 is a malicious package impersonating the legitimate 'chai-as-promised' library. It contains obfuscated code that, when used as documented, triggers execution of attacker-controlled JavaScript fetched from a remote server. This remote code execution occurs with full module require access, enabling potentially harmful operations on the user's machine.
AI Analysis
Technical Summary
The 'chai-as-staged' npm package (version 6.0.4) impersonates the popular 'chai-as-promised' testing library and includes a README copied from another unrelated project to appear legitimate. Its usage triggers a detached Node.js child process that runs an obfuscated script ('lib/initializeCaller.js'). This script hides a command-and-control (C2) endpoint and a custom HTTP header encoded in base64 under decoy environment variable names. At runtime, it decodes the URL to a remote JSON resource hosted on an anonymous static site, fetches it with the obfuscated header, extracts a '.cookie' field containing JavaScript code, and executes this code dynamically using the Function constructor with full require access. This results in arbitrary attacker-controlled code execution on the machine installing or using the package.
Potential Impact
This vulnerability allows remote attacker-controlled code execution on the user's machine with full access to Node.js require functionality. This can lead to arbitrary code execution, data theft, system compromise, or further malware deployment. The malicious package's impersonation of a legitimate library increases the risk of unsuspecting users installing it.
Mitigation Recommendations
No official patch or fix is currently available for this malicious package. Users should avoid installing or using 'chai-as-staged' version 6.0.4. Verify package authenticity before installation, prefer official and well-maintained packages, and remove any instances of this package from your environment. Monitor package sources carefully to prevent supply chain compromise.
MAL-2026-10047: Malicious code in chai-as-staged (npm)
Description
The npm package 'chai-as-staged' version 6.0.4 is a malicious package impersonating the legitimate 'chai-as-promised' library. It contains obfuscated code that, when used as documented, triggers execution of attacker-controlled JavaScript fetched from a remote server. This remote code execution occurs with full module require access, enabling potentially harmful operations on the user's machine.
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-staged' npm package (version 6.0.4) impersonates the popular 'chai-as-promised' testing library and includes a README copied from another unrelated project to appear legitimate. Its usage triggers a detached Node.js child process that runs an obfuscated script ('lib/initializeCaller.js'). This script hides a command-and-control (C2) endpoint and a custom HTTP header encoded in base64 under decoy environment variable names. At runtime, it decodes the URL to a remote JSON resource hosted on an anonymous static site, fetches it with the obfuscated header, extracts a '.cookie' field containing JavaScript code, and executes this code dynamically using the Function constructor with full require access. This results in arbitrary attacker-controlled code execution on the machine installing or using the package.
Potential Impact
This vulnerability allows remote attacker-controlled code execution on the user's machine with full access to Node.js require functionality. This can lead to arbitrary code execution, data theft, system compromise, or further malware deployment. The malicious package's impersonation of a legitimate library increases the risk of unsuspecting users installing it.
Mitigation Recommendations
No official patch or fix is currently available for this malicious package. Users should avoid installing or using 'chai-as-staged' version 6.0.4. Verify package authenticity before installation, prefer official and well-maintained packages, and remove any instances of this package from your environment. Monitor package sources carefully to prevent supply chain compromise.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- MAL-2026-10047
- Osv Schema Version
- 1.7.4
- Aliases
- []
- Ecosystems
- ["npm"]
- Database Specific Severity
- null
- Cvss Version
- null
Threat ID: 6a50bab068715ace43585923
Added to database: 07/10/2026, 09:26:08 UTC
Last enriched: 07/10/2026, 10:18:31 UTC
Last updated: 07/10/2026, 10:18:31 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.