MAL-2026-6995: Malicious code in chai-redirection (npm)
The npm package chai-redirection (versions 0.0.1, 0.0.3, and 0.0.4) contains malicious code that executes attacker-controlled JavaScript immediately upon being required. It spawns a detached Node.js process that fetches code from a mutable external source and executes it with full require access, enabling remote code execution. This malicious behavior occurs before any legitimate plugin functionality is used, making mere installation or inclusion a critical risk. The mutable external payload can be changed at any time without republishing the package, increasing the threat's persistence and unpredictability. Systems with this package installed should be considered fully compromised, and all secrets should be rotated. Removal of the package alone may not eliminate all malicious artifacts.
AI Analysis
Technical Summary
The chai-redirection npm package masquerades as a chai assertion plugin but contains embedded malicious code that triggers remote code execution immediately upon being required. Its main entry point spawns a detached Node child process that performs an HTTPS GET request to a mutable pastebin-style URL, retrieving JavaScript code from the response's 'cookie' field and executing it with full Node.js require privileges. A secondary code path fetches a token from a configurable URL and executes it similarly, providing a second remote code execution vector. Because the malicious code runs before any exports are accessed, simply requiring the package triggers execution of attacker-controlled code. The mutable external source allows the attacker to change the payload at any time without republishing the package, making the threat dynamic and persistent. This behavior effectively compromises any system that installs or runs this package.
Potential Impact
Any system that installs or runs the affected versions of chai-redirection is subject to immediate and full remote code execution by an attacker-controlled payload. This grants the attacker full control over the Node.js process environment, including access to require modules, enabling arbitrary code execution, data theft, and system compromise. Because the malicious code runs on package load, the risk exists even if the package's exported API is never used. The mutable external payload source means the attacker can update or change the malicious code at will, increasing the risk of ongoing compromise. Systems with this package should be considered fully compromised, and secrets or keys stored on them should be rotated from a trusted environment.
Mitigation Recommendations
No official patch or fix is currently available. The recommended mitigation is to immediately remove all affected versions (=0.0.1, =0.0.3, =0.0.4) of the chai-redirection package from all systems. Because the package executes attacker-controlled code with full privileges, any system that had this package installed or running should be treated as fully compromised. All secrets, credentials, and keys stored on the system should be rotated from a different, trusted machine. Additional forensic analysis and remediation may be necessary to ensure complete removal of any malicious artifacts. Monitor vendor advisories for any future updates or official fixes.
MAL-2026-6995: Malicious code in chai-redirection (npm)
Description
The npm package chai-redirection (versions 0.0.1, 0.0.3, and 0.0.4) contains malicious code that executes attacker-controlled JavaScript immediately upon being required. It spawns a detached Node.js process that fetches code from a mutable external source and executes it with full require access, enabling remote code execution. This malicious behavior occurs before any legitimate plugin functionality is used, making mere installation or inclusion a critical risk. The mutable external payload can be changed at any time without republishing the package, increasing the threat's persistence and unpredictability. Systems with this package installed should be considered fully compromised, and all secrets should be rotated. Removal of the package alone may not eliminate all malicious artifacts.
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-redirection npm package masquerades as a chai assertion plugin but contains embedded malicious code that triggers remote code execution immediately upon being required. Its main entry point spawns a detached Node child process that performs an HTTPS GET request to a mutable pastebin-style URL, retrieving JavaScript code from the response's 'cookie' field and executing it with full Node.js require privileges. A secondary code path fetches a token from a configurable URL and executes it similarly, providing a second remote code execution vector. Because the malicious code runs before any exports are accessed, simply requiring the package triggers execution of attacker-controlled code. The mutable external source allows the attacker to change the payload at any time without republishing the package, making the threat dynamic and persistent. This behavior effectively compromises any system that installs or runs this package.
Potential Impact
Any system that installs or runs the affected versions of chai-redirection is subject to immediate and full remote code execution by an attacker-controlled payload. This grants the attacker full control over the Node.js process environment, including access to require modules, enabling arbitrary code execution, data theft, and system compromise. Because the malicious code runs on package load, the risk exists even if the package's exported API is never used. The mutable external payload source means the attacker can update or change the malicious code at will, increasing the risk of ongoing compromise. Systems with this package should be considered fully compromised, and secrets or keys stored on them should be rotated from a trusted environment.
Mitigation Recommendations
No official patch or fix is currently available. The recommended mitigation is to immediately remove all affected versions (=0.0.1, =0.0.3, =0.0.4) of the chai-redirection package from all systems. Because the package executes attacker-controlled code with full privileges, any system that had this package installed or running should be treated as fully compromised. All secrets, credentials, and keys stored on the system should be rotated from a different, trusted machine. Additional forensic analysis and remediation may be necessary to ensure complete removal of any malicious artifacts. Monitor vendor advisories for any future updates or official fixes.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- MAL-2026-6995
- Osv Schema Version
- 1.7.4
- Aliases
- ["GHSA-89c7-5mf7-c86r"]
- Ecosystems
- ["npm"]
- Database Specific Severity
- null
- Cvss Version
- null
Threat ID: 6a50ba2f68715ace4357cff1
Added to database: 07/10/2026, 09:23:59 UTC
Last enriched: 07/10/2026, 09:29:45 UTC
Last updated: 07/10/2026, 09:29:45 UTC
Views: 2
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.
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.