Malicious code in chai-leaf (npm)
Description
The npm package chai-leaf versions 1.4.5, 1.4.6, 1.4.7, and 1.4.8 contains a malicious obfuscated JavaScript file that executes immediately upon import. This file is designed to steal credentials from common installer directories such as ~/.ssh and ~/.aws and exfiltrate them via HTTP. The package misrepresents itself with inconsistent documentation and mimics legitimate packages to evade detection. Any system with this package installed should be considered fully compromised, and all secrets should be rotated immediately from a secure environment.
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 npm package chai-leaf (versions 1.4.5 through 1.4.8) includes a large obfuscated JavaScript file (lib/config.js) that runs at load time. This file contains code to steal credentials from the installer's home directory, specifically targeting SSH and AWS credential directories, and exfiltrates these secrets over HTTP using the axios library. The package's metadata and README are deceptive, copying content from unrelated legitimate packages to disguise its malicious intent. The presence of this package on a system indicates a full compromise, as it grants remote attackers access to sensitive credentials.
Potential Impact
Systems with the affected versions of chai-leaf installed are fully compromised. Attackers can steal SSH and AWS credentials stored on the system, potentially leading to unauthorized access to other systems and cloud resources. The compromise may extend beyond the package itself, as attackers could deploy additional malicious software. Removing the package alone does not guarantee remediation due to possible persistent backdoors.
Defensive Guidance
Immediate removal of the chai-leaf package versions 1.4.5, 1.4.6, 1.4.7, and 1.4.8 is required. All credentials and secrets stored on the compromised system, including SSH keys and AWS credentials, must be rotated from a separate, secure system. Due to the high likelihood of full system compromise, a comprehensive incident response and forensic analysis should be conducted to identify and remove any additional malicious artifacts. No official patch or fix is available; remediation relies on removal and credential rotation.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- MAL-2026-10940
- Osv Schema Version
- 1.7.4
- Aliases
- ["GHSA-m3c7-2j38-rjh7"]
- Ecosystems
- ["npm"]
Threat ID: 6a96f319acd9273b49e49709
Added to database: 09/01/2026, 15:45:29 UTC
Last enriched: 09/08/2026, 09:23:07 UTC
Last updated: 10/01/2026, 22:43:40 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.
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.