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

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** CRITICAL 9.7
- **CVSS:** 9.7 (v3.1, CNA) `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Network; Attack complexity: Low; Privileges required: None; User interaction: Required; Scope: Changed (impact reaches other components); Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Remote, no login needed
- **EPSS:** 0.89% (percentile 57, 2026-11-26)
- **CWE:** CWE-1385
- **Aliases:** GHSA-9crc-q9x8-hgqq
- **Published:** 2025-02-04T17:00:57.000Z
- **Modified:** 2026-06-17T08:59:53.550Z

## Who should check

- Projects that depend on npm package vitest (\>= 1.0.0, \< 1.6.1)
- Anyone running vitest-dev vitest \<= 0.0.125; \>= 1.0.0, \< 1.6.1; \>= 2.0.0, \< 2.1.9; \>= 3.0.0, \< 3.0.5

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

## Affected and fixed versions

- npm `vitest`: affected \>= 1.0.0, \< 1.6.1; fixed 1.6.1, 2.1.9, 3.0.5 (osv)
- vitest-dev vitest: \<= 0.0.125; \>= 1.0.0, \< 1.6.1; \>= 2.0.0, \< 2.1.9; \>= 3.0.0, \< 3.0.5 (cvelist)

## Mitigation

- Upgrade vitest to one of 1.6.1, 2.1.9, 3.0.5 (or later in the same release line).

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2025-24964. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2025-24964.md
Affected: vitest >= 1.0.0, < 1.6.1
Fixed in: 1.6.1, 2.1.9, 3.0.5

Steps:
1. Search this machine and project for vitest (npm), vitest-dev vitest: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2025-24964 being exploited?

There is no confirmed exploitation: CVE-2025-24964 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.89% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2025-24964?

Critical: CVSS 9.7 (v3.1, scored by CNA). Remote, no login needed. A user has to take an action, such as opening a link, for the attack to work.

### Which versions are affected by CVE-2025-24964?

vitest \>= 1.0.0, \< 1.6.1.

### Is there a fix for CVE-2025-24964?

Yes. Fixed in 1.6.1, 2.1.9, 3.0.5. Upgrade vitest to one of 1.6.1, 2.1.9, 3.0.5 (or later in the same release line).

### How do I check if I'm affected by CVE-2025-24964?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

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

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2025-24964>
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/GHSA-9crc-q9x8-hgqq> (license: <https://creativecommons.org/licenses/by/4.0/>)

HTML: <https://flawdb.com/CVE-2025-24964> · JSON: <https://flawdb.com/api/v1/entries/CVE-2025-24964>
