Malicious code in vitest-agent (npm)
--- _-= Per source details. Do not edit below this line.=-_ ## Source: amazon-inspector (6e0165cbb3d6ed37a96889c4b016463706346e1c09413635c31ea1ceedde8774) The package's postinstall script (`node lib/utils/index.js`) spawns a detached, stdio-suppressed Node child process that runs `lib/utils/smtp-connection/index.js`. That file fetches JavaScript from `https://jsonkeeper.com/b/WDH3V` via axios and executes the response with `new Function("require", r.data.cookie)(require)`, running unpinned, mutable, non-publisher code on the installer's machine at `npm install` time. The package is named `vitest-agent` but its `main` and shipped source are a verbatim copy of nodemailer (author field `Andris Reinman`, description is an unrelated React copyright string), a name/identity mismatch consistent with a lure targeting vitest ecosystem users. Concealment signals reinforce the dropper: a ~256 KB `LICENSE` file sits adjacent to a 185-byte dropper `index.js` under `lib/utils/smtp-connection/`, and path names mirror legitimate nodemailer layout as cover. Because the harmful code path fires automatically from the postinstall lifecycle hook, installers are compromised without any explicit user action beyond installing the package. ## Source: ghsa-malware (c760a9cc4fdf3746f5c3ea670a49bc3441556a64a1fe3c97314375d427d7f1d4) Any computer that has this package installed or running should be considered fully compromised. All secrets and keys stored on that computer should be rotated immediately from a different computer. The package should be removed, but as full control of the computer may have been given to an outside entity, there is no guarantee that removing the package will remove all malicious software resulting from installing it.
AI Analysis
Technical Summary
The 'vitest-agent' npm package (versions 1.0.5 and 1.0.6) includes a postinstall lifecycle script that spawns a detached Node.js child process executing code fetched dynamically from a remote URL. This code execution occurs without user interaction beyond installing the package. The package's source code is a verbatim copy of nodemailer but with misleading metadata and file structures designed to disguise its malicious behavior. The malicious payload fetches JavaScript from 'https://jsonkeeper.com/b/WDH3V' and executes it using 'new Function', allowing arbitrary code execution on the installer's machine. This results in a full compromise of any system where the package is installed.
Potential Impact
Systems that install 'vitest-agent' versions 1.0.5 or 1.0.6 are fully compromised as the package executes arbitrary remote code during installation. This can lead to unauthorized access, data theft, and control over the affected machine. All secrets and keys stored on the compromised system should be considered exposed and must be rotated immediately. Removing the package alone may not eliminate all malicious components due to the potential for persistent backdoors or additional malware installed by the malicious code.
Mitigation Recommendations
No official patch or fix is currently available for this malicious package. The recommended mitigation is to immediately remove the 'vitest-agent' package versions 1.0.5 and 1.0.6 from all systems. Treat any system with this package installed as fully compromised. Rotate all secrets, keys, and credentials from a separate, trusted environment. Avoid installing packages from untrusted or suspicious sources and verify package authenticity before installation.
Malicious code in vitest-agent (npm)
Description
--- _-= Per source details. Do not edit below this line.=-_ ## Source: amazon-inspector (6e0165cbb3d6ed37a96889c4b016463706346e1c09413635c31ea1ceedde8774) The package's postinstall script (`node lib/utils/index.js`) spawns a detached, stdio-suppressed Node child process that runs `lib/utils/smtp-connection/index.js`. That file fetches JavaScript from `https://jsonkeeper.com/b/WDH3V` via axios and executes the response with `new Function("require", r.data.cookie)(require)`, running unpinned, mutable, non-publisher code on the installer's machine at `npm install` time. The package is named `vitest-agent` but its `main` and shipped source are a verbatim copy of nodemailer (author field `Andris Reinman`, description is an unrelated React copyright string), a name/identity mismatch consistent with a lure targeting vitest ecosystem users. Concealment signals reinforce the dropper: a ~256 KB `LICENSE` file sits adjacent to a 185-byte dropper `index.js` under `lib/utils/smtp-connection/`, and path names mirror legitimate nodemailer layout as cover. Because the harmful code path fires automatically from the postinstall lifecycle hook, installers are compromised without any explicit user action beyond installing the package. ## Source: ghsa-malware (c760a9cc4fdf3746f5c3ea670a49bc3441556a64a1fe3c97314375d427d7f1d4) Any computer that has this package installed or running should be considered fully compromised. All secrets and keys stored on that computer should be rotated immediately from a different computer. The package should be removed, but as full control of the computer may have been given to an outside entity, there is no guarantee that removing the package will remove all malicious software resulting from installing it.
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-agent' npm package (versions 1.0.5 and 1.0.6) includes a postinstall lifecycle script that spawns a detached Node.js child process executing code fetched dynamically from a remote URL. This code execution occurs without user interaction beyond installing the package. The package's source code is a verbatim copy of nodemailer but with misleading metadata and file structures designed to disguise its malicious behavior. The malicious payload fetches JavaScript from 'https://jsonkeeper.com/b/WDH3V' and executes it using 'new Function', allowing arbitrary code execution on the installer's machine. This results in a full compromise of any system where the package is installed.
Potential Impact
Systems that install 'vitest-agent' versions 1.0.5 or 1.0.6 are fully compromised as the package executes arbitrary remote code during installation. This can lead to unauthorized access, data theft, and control over the affected machine. All secrets and keys stored on the compromised system should be considered exposed and must be rotated immediately. Removing the package alone may not eliminate all malicious components due to the potential for persistent backdoors or additional malware installed by the malicious code.
Mitigation Recommendations
No official patch or fix is currently available for this malicious package. The recommended mitigation is to immediately remove the 'vitest-agent' package versions 1.0.5 and 1.0.6 from all systems. Treat any system with this package installed as fully compromised. Rotate all secrets, keys, and credentials from a separate, trusted environment. Avoid installing packages from untrusted or suspicious sources and verify package authenticity before installation.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- MAL-2026-6710
- Osv Schema Version
- 1.7.4
- Aliases
- ["GHSA-w2r4-4x6j-3h5x"]
- Ecosystems
- ["npm"]
- Database Specific Severity
- null
- Cvss Version
- null
Threat ID: 6a46ed0327e9c797194451eb
Added to database: 07/02/2026, 22:58:11 UTC
Last enriched: 07/02/2026, 23:31:56 UTC
Last updated: 07/28/2026, 13:13:36 UTC
Views: 41
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.