Malicious code in chalk-lib (npm)
Description
The chalk-lib npm package is a malicious typosquat of the legitimate chalk package. It contains an empty library body but executes a postinstall script that downloads and runs a Windows executable from a GitHub URL. The script also attempts to extend the attack from WSL or Linux environments to the Windows host via a PowerShell bridge. Additionally, it sends platform information to a hardcoded IP address over plain HTTP. This behavior indicates a supply chain attack through a malicious npm package.
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
chalk-lib is a typosquatting npm package mimicking the popular chalk package but contains no legitimate code exports. Its postinstall lifecycle script XOR-decodes a hardcoded URL to download a Windows executable to the temporary directory and executes it silently. When installed in WSL or Linux environments with Windows hosts, it uses a PowerShell bridge to run the same binary on the Windows host, crossing the WSL boundary. The script also exfiltrates platform data to a hardcoded IP address over unencrypted HTTP. The URLs and commands are obfuscated as integer arrays decoded via XOR to evade detection.
Potential Impact
Installation of chalk-lib version 1.0.0 results in execution of a potentially malicious Windows executable, which could lead to arbitrary code execution on the Windows host. The cross-environment execution from WSL/Linux to Windows increases the attack surface. The exfiltration of platform information to an attacker-controlled server indicates potential reconnaissance or further targeted attacks. This supply chain compromise can lead to system compromise and data leakage.
Mitigation Recommendations
Users should avoid installing the chalk-lib package, as it is a malicious typosquat of the legitimate chalk package. Remove any installations of chalk-lib version 1.0.0 from systems. Since no official patch or fix exists, rely on package name verification and use only trusted packages from official sources. Employ dependency scanning tools to detect and block typosquatting or malicious packages. Monitor for any signs of the downloaded executable or network connections to the indicated IP address and remove any artifacts found.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- MAL-2026-14167
- Osv Schema Version
- 1.7.4
- Ecosystems
- ["npm"]
Threat ID: 6a85b4caacd9273b49252bab
Added to database: 08/19/2026, 13:51:06 UTC
Last enriched: 08/19/2026, 14:48:37 UTC
Last updated: 10/02/2026, 13:52:50 UTC
Views: 24
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.