Vulnerability in Vitest-Dev Vitest

CVE-2025-24964

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.

Published · last modified .

CVSS v3 metric

CVSS v3 base score 9.6 (Critical). Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H.

EPSS exploit prediction

EPSS: 0.007 (50.5th percentile), scored .

Very low probability of exploitation in the next 30 days; routine patching cadence is appropriate. 51st percentile — 50.5% of CVEs in the catalogue have a lower EPSS than this one. How to read EPSS.

EPSS trend (30 days)EPSS over the last 30 days for CVE-2025-24964: held from 0.007 to 0.007.

EPSS over last 30 days · oldest: 0.007 · newest: 0.007 · change: 0.000

Affected products

Weakness classification (CWE)

References

Frequently asked questions

What is CVE-2025-24964?
CVE-2025-24964 is a critical-severity vulnerability in Vitest-Dev Vitest, classified under CWE-1385. CVSS score: 9.6/10. Published 2025-02-04.
How severe is CVE-2025-24964?
Critical severity. CVSS v3 base score is 9.6 out of 10.