CVE-2025-24964 Details
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.
A critical vulnerability in Vitest, a testing framework powered by Vite, allows for arbitrary remote code execution. This issue arises when the Vitest API server is active and a user accesses a malicious website, leading to Cross-site WebSocket hijacking (CSWSH) attacks. The vulnerability is present in Vitest versions through 0.0.125, 1.0.0 prior to 1.6.1, 2.0.0 through 2.1.8, and 3.0.0 through 3.0.4. When the 'api' option is enabled, Vitest initiates a WebSocket server that lacks proper Origin header validation and authorization mechanisms, making it susceptible to CSWSH attacks. An attacker can exploit this by using the 'saveTestFile' API to inject code into a test file, which can then be executed by calling the 'rerun' API. This vulnerability specifically affects users utilizing the Vitest serve API.
Users are advised to upgrade to Vitest versions 1.6.1, 2.1.9, or 3.0.5, where this vulnerability has been patched.
Metrics
CVSS 4.0 Severity and Vector Strings:
No CVSS 4.0 data is available for this CVE.
CVSS 3.x Severity and Vector Strings:
No data available for CVSS Version 2.0 on this CVE.
CISA-ADP
Assessed Feb 4, 2025References to Advisories, Solutions, and Tools
By selecting these links, you will be leaving this site. These are references gathered from the official CVE record and are not endorsed by Volerion.
Weakness Enumeration
| CWE-ID | CWE Name | Source |
|---|---|---|
| CWE-1385 | Missing Origin Validation in WebSockets | [email protected] |
Affected Products
| Product | Versions |
|---|---|
| vitest.dev vitest | <= 0.0.125 >= 1.0.0, < 1.6.1 >= 2.0.0, < 2.1.9 >= 3.0.0, < 3.0.5 |
CPE
Remediation
| |
Change History
4 change records found show changes
| Date | Action | Recorded By |
|---|---|---|
| Jun 17, 2026 | CVE Modified | [email protected] |
| Jun 17, 2026 | CVE Modified | CISA-ADP |
| Dec 31, 2025 | Initial Analysis | [email protected] |
| Feb 4, 2025 | New CVE Received | [email protected] |