Malicious code in chai-as-type (npm)
The npm package 'chai-as-type' is a malicious package impersonating popular assertion libraries. When imported, it downloads and executes attacker-controlled JavaScript code from a remote server, enabling arbitrary code execution in the Node.js environment. The package fetches payloads from mutable public JSON paste hosts, allowing the attacker to update the malicious code dynamically without republishing the package. This behavior can lead to credential theft, persistence, and other malicious activities. The malicious code is triggered either by invoking the exported middleware or running a specific npm script. The affected versions are 7.0.5 and 1.1.9.
AI Analysis
Technical Summary
The 'chai-as-type' npm package contains malicious code that, upon import, downloads a command-and-control (C2) dropper from a remote URL and executes it within the Node.js process. It impersonates legitimate chai assertion libraries but actually functions as a pino-shaped middleware that spawns a child process to run a loader script. This loader fetches attacker-controlled JavaScript from a public JSON paste host, decodes base64-encoded URLs, and executes the payload with full module access. The attacker can modify the remote payload at any time, enabling dynamic delivery of malicious code such as credential theft or persistence mechanisms without republishing the package. The malicious behavior is triggered either by invoking the middleware or running the 'smoke:pino' npm script.
Potential Impact
This malicious package allows arbitrary code execution in the Node.js environment of any project that installs or imports it. Because the payload is fetched dynamically from a mutable remote source, attackers can update the malicious code at will, potentially leading to credential theft, system compromise, or persistence. The impersonation of popular libraries increases the risk of accidental installation by developers. There are no known exploits in the wild reported yet.
Mitigation Recommendations
No official patch or remediation is currently available. Users should immediately remove the 'chai-as-type' package versions 7.0.5 and 1.1.9 from their projects and avoid installing or importing this package. Verify dependencies to ensure no indirect inclusion of this malicious package. Monitor for updates from trusted sources regarding remediation or package takedown.
Malicious code in chai-as-type (npm)
Description
The npm package 'chai-as-type' is a malicious package impersonating popular assertion libraries. When imported, it downloads and executes attacker-controlled JavaScript code from a remote server, enabling arbitrary code execution in the Node.js environment. The package fetches payloads from mutable public JSON paste hosts, allowing the attacker to update the malicious code dynamically without republishing the package. This behavior can lead to credential theft, persistence, and other malicious activities. The malicious code is triggered either by invoking the exported middleware or running a specific npm script. The affected versions are 7.0.5 and 1.1.9.
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-type' npm package contains malicious code that, upon import, downloads a command-and-control (C2) dropper from a remote URL and executes it within the Node.js process. It impersonates legitimate chai assertion libraries but actually functions as a pino-shaped middleware that spawns a child process to run a loader script. This loader fetches attacker-controlled JavaScript from a public JSON paste host, decodes base64-encoded URLs, and executes the payload with full module access. The attacker can modify the remote payload at any time, enabling dynamic delivery of malicious code such as credential theft or persistence mechanisms without republishing the package. The malicious behavior is triggered either by invoking the middleware or running the 'smoke:pino' npm script.
Potential Impact
This malicious package allows arbitrary code execution in the Node.js environment of any project that installs or imports it. Because the payload is fetched dynamically from a mutable remote source, attackers can update the malicious code at will, potentially leading to credential theft, system compromise, or persistence. The impersonation of popular libraries increases the risk of accidental installation by developers. There are no known exploits in the wild reported yet.
Mitigation Recommendations
No official patch or remediation is currently available. Users should immediately remove the 'chai-as-type' package versions 7.0.5 and 1.1.9 from their projects and avoid installing or importing this package. Verify dependencies to ensure no indirect inclusion of this malicious package. Monitor for updates from trusted sources regarding remediation or package takedown.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- MAL-2026-2740
- Osv Schema Version
- 1.7.4
- Aliases
- ["GHSA-38w3-8j54-936j"]
- Ecosystems
- ["npm"]
Threat ID: 6a96f319acd9273b49e49721
Added to database: 09/01/2026, 15:45:29 UTC
Last enriched: 09/08/2026, 09:08:35 UTC
Last updated: 09/10/2026, 19:38:50 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.
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.