Security Digest · Vulnerability record
CVE-2025-24964: Vitest allows Remote Code Execution when accessing a malicious website while Vitest API server is listening
Vitest is a testing framework powered by Vite.
CVSS 9.7 Critical EPSS 0.7% · p52
Should you act?
Critical and remotely reachable
No known exploitation yet, but it is network-reachable without credentials. This signal is computed from CISA KEV, EPSS and CVSS data; it is not an editorial verdict.
- Not in CISA KEV, but CISA’s SSVC assessment records a public proof-of-concept, so attack code exists.
- EPSS 0.7%, percentile 52: FIRST’s model estimates a 0.7% chance of exploitation activity in the next 30 days, higher than 52% of all scored CVEs (moderate). EPSS is a probability, not a verdict.
- Needs a user to click or open something. Phishing makes that realistic, but it is not wormable.
- Only applies if your dependency tree includes
vitest(npm) >= 1.0.0, < 1.6.1, fixed in 1.6.1;vitest(npm) >= 2.0.0, < 2.1.9, fixed in 2.1.9;vitest(npm) >= 3.0.0, < 3.0.5, fixed in 3.0.5;vitest(npm) <= 0.0.125, no fixed version listed. Check your lockfile, including transitive dependencies.
What it is
Vitest is a testing framework powered by Vite. Affected versions are subject to arbitrary remote Code Execution when accessing a malicious website while Vitest API server is listening by Cross-site WebSocket hijacking (CSWSH) attacks. When api option is enabled (Vitest UI enables it), Vitest starts a WebSocket server. This WebSocket server did not check Origin header and did not have any authorization mechanism and was vulnerable to CSWSH attacks. This WebSocket server has saveTestFile API that can edit a test file and rerun API that can rerun the tests. An attacker can execute arbitrary code by injecting a code in a test file by the saveTestFile API and then running that file by calling the rerun API. This vulnerability can result in remote code execution for users that are using Vitest serve API. This issue has been patched in versions 1.6.1, 2.1.9 and 3.0.5. Users are advised to upgrade. There are no known workarounds for this vulnerability.
From the GitHub advisory
Summary Arbitrary remote Code Execution when accessing a malicious website while Vitest API server is listening by Cross-site WebSocket hijacking (CSWSH) attacks.
Details When api option is enabled (Vitest UI enables it), Vitest starts a WebSocket server. This WebSocket server did not check Origin header and did not have any authorization mechanism and was vulnerable to CSWSH attacks. https://github.com/vitest-dev/vitest/blob/9a581e1c43e5c02b11e2a8026a55ce6a8cb35114/packages/vitest/src/api/setup.ts#L32-L46
This WebSocket server has saveTestFile API that can edit a test file and rerun API that can rerun the tests. An attacker can execute arbitrary code by injecting a code in a test file by the saveTestFile API and then running that file by calling the rerun API. https://github.com/vitest-dev/vitest/blob/9a581e1c43e5c02b11e2a8026a55ce6a8cb35114/packages/vitest/src/api/setup.ts#L66-L76
PoC 1. Open Vitest UI. 2. Access a malicious web site with the script below. 3. If you have calc executable in PATH env var (you'll likely have it if you are running on Windows), that application will be executed.
Impact This vulnerability can result in remote code execution for users that are using Vitest serve API.
Weakness type: CWE-1385.
Product: vitest (npm) · Assigned by: GitHub_M · Published: 2025-02-04
Affected and fixed versions
| Ecosystem | Package | Vulnerable | First fixed |
|---|---|---|---|
| npm | vitest | >= 1.0.0, < 1.6.1 | 1.6.1 |
| npm | vitest | >= 2.0.0, < 2.1.9 | 2.1.9 |
| npm | vitest | >= 3.0.0, < 3.0.5 | 3.0.5 |
| npm | vitest | <= 0.0.125 | none listed |
| Vendor | Product | Affected versions (per CVE record) |
|---|---|---|
| vitest-dev | vitest | <= 0.0.125, >= 1.0.0, < 1.6.1, >= 2.0.0, < 2.1.9, >= 3.0.0, < 3.0.5 |
Severity scores
| Scored by | CVSS | Score | Vector |
|---|---|---|---|
| GitHub_M | 3.1 | 9.7 Critical | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H |
| GitHub | 3.1 | 9.6 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H |
- Attack vector: network (remotely reachable)
- Attack complexity: low
- Privileges required: none (no login)
- User interaction: required (a user must click/open something)
- Scope: changed (can affect other components)
CVSS measures how bad a flaw is if exploited, not how likely exploitation is. Read it next to the exploitation data below.
Exploitation and urgency
- CISA KEV: not listed (no confirmed in-the-wild exploitation known to CISA).
- CISA SSVC assessment: exploitation poc, automatable no, technical impact total.
- FIRST EPSS (model of 2026-10-21): 0.68% probability of exploitation activity in the next 30 days; percentile 52.
Timeline
- — CVE record published by GitHub_M
- — GitHub-reviewed advisory GHSA-9crc-q9x8-hgqq published (critical)
- — CVE record last updated
Sources and references
Original sources first. Version and fix details should always be confirmed against the vendor or project advisory.
Vulnerability records
- GitHub Advisory GHSA-9crc-q9x8-hgqq github.com
- CVE.org record CVE-2025-24964 cve.org
- NVD entry CVE-2025-24964 nvd.nist.gov
Other references from the CVE record and advisory
- github.com github.com
- github.com github.com
- github.com github.com
- vitest.dev vitest.dev
- github.com github.com
- github.com github.com
- github.com github.com