Vulnerabilities

CVE-2025-24964

High 8.8 CVSS 3.1

Description

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.

Description as published by the source, in English.

Key facts

Published
2025-02-04
Last modified
2026-06-17
Assigned by
security-advisories@github.com
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Scored by
nvd@nist.gov (NVD Primary)
Probability of exploitation
0.7 % higher than 48 % of all known vulnerabilities
EPSS, next 30 days, model v2026.06.15
Fix available
Not registered in the sources

Affected products

Vendor Product Versions Status
vitest (npm) ≤ 0.0.125 Affected
vitest (npm) ≥ 1.0.0, < 1.6.1 Affected
vitest (npm) ≥ 2.0.0, < 2.1.9 Affected
vitest (npm) ≥ 3.0.0, < 3.0.5 Affected
Vitest.dev Vitest ≤ 0.0.125 Affected
Vitest.dev Vitest ≥ 1.0.0, < 1.6.1 Affected
Vitest.dev Vitest ≥ 2.0.0, < 2.1.9 Affected
Vitest.dev Vitest ≥ 3.0.0, < 3.0.5 Affected

Weakness type

References

Does this affect you?

A vulnerability matters only if you run the product, in an affected version, somewhere an attacker can reach.

Check your asset list Browse all vulnerabilities