Skip to main content

Malicious code in vitest-preview-pro (npm)

0
Critical
Published: 08/04/2026 (08/04/2026, 23:56:52 UTC)
Source: GCVE Database
Product: vitest-preview-pro

Description

--- _-= Per source details. Do not edit below this line.=-_ ## Source: amazon-inspector (367fd88886da38fc8a88929cfb486d6031ee42d44499b5f7a2d47d4e91d5b075) The package is published under a name suggesting a Vitest preview utility, but the shipped code is a rebranded copy of nodemailer with an added preinstall dropper. package.json declares `preinstall: node lib/utils/index.js`, which uses child_process.spawn(process.execPath, [lib/utils/smtp-connection/index.js], {detached:true, stdio:['ignore','ignore','ignore']}).unref() to launch a detached, fully silenced child that survives beyond `npm install`. The spawned file is obfuscated with a custom basE91 string-array decoder; the decoded top-level async IIFE calls globalThis.fetch against a URL on api.jsonbin.io/v3/, parses the JSON response, and passes the `record.cookie` field to new Function('require', body)(require), executing attacker-controlled JavaScript with full `require` access on the installer at install time. api.jsonbin.io is a public, mutable, anonymous JSON-hosting service, so the executed payload can change at any time. Adjacent to the loader, lib/utils/smtp-connection/LICENSE is a 262KB file whose contents are a hex-encoded ~131KB opaque binary blob rather than license text, colocated with the loader as a staged secondary payload. The advertised package purpose has no relationship to the shipped SMTP source, providing cover for the injected dropper. ## Source: ghsa-malware (3b0064885ea23f15a06a6ad10a6d57a101499e6015da4d94d8c49cc481ae34f0) 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

npmghsa
vitest-preview-pro
Affected versions
=10.0.3=10.0.7=10.0.5=10.0.6

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

AILast updated: 08/07/2026, 15:21:02 UTC

Technical Analysis

The 'vitest-preview-pro' npm package versions 10.0.3, 10.0.5, 10.0.6, and 10.0.7 are malicious. The package contains a preinstall script that runs a detached child process executing obfuscated JavaScript code. This code fetches a JSON payload from api.jsonbin.io, a public and mutable JSON hosting service, and executes the 'record.cookie' field as JavaScript with full require privileges during installation. The package's advertised purpose is a Vitest preview utility, but it actually contains a rebranded nodemailer library with an added dropper. Additionally, a large hex-encoded binary blob is included as a staged secondary payload disguised as a license file. This setup allows attackers to dynamically change the payload delivered to victims at install time.

Potential Impact

Users installing affected versions of 'vitest-preview-pro' are at risk of arbitrary code execution during package installation. The attacker-controlled payload executes with full Node.js require access, enabling potential compromise of the host system, installation of additional malware, data exfiltration, or other malicious activities. The use of a public, mutable JSON hosting service for payload delivery means the malicious code can be updated dynamically, increasing the threat's persistence and adaptability.

Mitigation Recommendations

No official patch or remediation guidance is provided in the available data. Users should immediately avoid installing or using 'vitest-preview-pro' versions 10.0.3, 10.0.5, 10.0.6, and 10.0.7. Remove these versions from any systems where they are installed. Consider auditing your environment for signs of compromise if these versions were used. Monitor official npm advisories or the package maintainer for updates or removal of the malicious package. Until a fix or official guidance is available, do not trust or use this package.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Gcve Source
db.gcve.eu
Osv Id
MAL-2026-12004
Osv Schema Version
1.7.4
Ecosystems
["npm"]

Threat ID: 6a75f709bf8831d53984ec70

Added to database: 08/07/2026, 15:17:29 UTC

Last enriched: 08/07/2026, 15:21:02 UTC

Last updated: 09/22/2026, 01:14:49 UTC

Views: 23

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

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

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses