Malicious code in vitest-cli-dev (npm)
Description
The npm package [email protected] is a typosquatting malicious package impersonating a legitimate vitest tool. It contains nodemailer and an install-time dropper that executes attacker-controlled JavaScript during installation by fetching mutable remote JSON payloads. This code runs detached from the npm process, allowing persistence beyond installation. The attacker can change the payloads at any time, enabling dynamic malicious behavior.
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 vitest-cli-dev package version 10.0.7 is a typosquat package whose name and homepage mimic a legitimate vitest tool. Its tarball includes nodemailer and a postinstall script that runs lib/utils/index.js, which spawns a detached Node.js child process executing lib/utils/smtp-connection/index.js. This child process fetches JSON data from two remote URLs and executes the 'cookie' field content as JavaScript via new Function, passing the require function to it. This allows arbitrary attacker-controlled code execution on the machine at npm install time. The detached child process is unreferenced, allowing it to continue running independently of the npm process. The remote JSON payloads are mutable, meaning the attacker can change the executed code at any time after installation.
Potential Impact
This vulnerability enables arbitrary code execution on the installer's machine during npm install, potentially leading to full system compromise. Because the malicious code runs detached and independently, it can persist beyond the installation process. The attacker can dynamically update the malicious payloads remotely, increasing the risk and flexibility of exploitation.
Mitigation Recommendations
No official patch or remediation is currently documented. Users should avoid installing the vitest-cli-dev package version 10.0.7. Verify package authenticity before installation, especially for similarly named packages. Consider using trusted package registries and tools that detect typosquatting or malicious packages. Monitor for updates from the package maintainers or npm security advisories for any official fixes.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- MAL-2026-15870
- Osv Schema Version
- 1.7.4
- Ecosystems
- ["npm"]
Threat ID: 6a9ad4f3acd9273b49b67962
Added to database: 09/04/2026, 14:25:55 UTC
Last enriched: 09/07/2026, 16:23:30 UTC
Last updated: 10/01/2026, 23:04:18 UTC
Views: 20
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.