# CVE-2025-24964: Remote Code Execution when accessing a malicious website while Vitest API server is listening

- Severity: Critical 9.7 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.68%, higher than 53% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2025-02-04T17:00:57.000Z
- Modified: 2026-06-17T08:59:53.550Z
- Also known as: GHSA-9crc-q9x8-hgqq
- Weaknesses: CWE-1385
- SSVC (CISA-ADP): exploitation poc, automatable no, technical impact total
- Assigned by: GitHub_M

## 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.

(As written by CVE List.)

## Affected

- vitest-dev vitest: <= 0.0.125; >= 1.0.0, < 1.6.1; >= 2.0.0, < 2.1.9; >= 3.0.0, < 3.0.5
- vitest (npm): from 1.0.0 before 1.6.1; from 2.0.0 before 2.1.9; from 3.0.0 before 3.0.5; up to 0.0.125
- vitest.dev vitest: up to 0.0.125; from 1.0.0 before 1.6.1; from 2.0.0 before 2.1.9; from 3.0.0 before 3.0.5

## Every score

- GitHub_M: CVSS: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: CVSS:3.1 9.6 Critical `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H`
- NVD: CVSS:3.1 8.8 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H`

## References

- <https://github.com/vitest-dev/vitest/security/advisories/GHSA-9crc-q9x8-hgqq> (exploit, vendor-advisory, web)
- <https://github.com/vitest-dev/vitest/blob/9a581e1c43e5c02b11e2a8026a55ce6a8cb35114/packages/vitest/src/api/setup.ts#L32-L46> (product, web)
- <https://github.com/vitest-dev/vitest/blob/9a581e1c43e5c02b11e2a8026a55ce6a8cb35114/packages/vitest/src/api/setup.ts#L66-L76> (product, web)
- <https://vitest.dev/config/#api> (product, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2025-24964> (advisory)
- <https://github.com/vitest-dev/vitest/commit/191ef9e34c867d0efd04f49b3d38193a68e825dc> (web)
- <https://github.com/vitest-dev/vitest/commit/7ce9fbb4972d45c6fd34c843645ef6f549bbb241> (web)
- <https://github.com/vitest-dev/vitest/commit/e0fe1d81e2d4bcddb1c6ca3c5c3970d8ba697383> (web)
- <https://github.com/vitest-dev/vitest> (package)

## Sources

- CVE List: [CVE-2025-24964](https://www.cve.org/CVERecord?id=CVE-2025-24964), CVE Terms of Use, modified 2025-02-12
- GitHub Advisory Database: [GHSA-9crc-q9x8-hgqq](https://github.com/advisories/GHSA-9crc-q9x8-hgqq), CC-BY-4.0, modified 2025-02-04
- NVD: [CVE-2025-24964](https://nvd.nist.gov/vuln/detail/CVE-2025-24964), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2025-24964 · Whole record: https://cve.day/CVE-2025-24964.json · Rebuilt by cve.day 2026-11-25T22:58:53.793Z
