---
title: "CVE-2025-24964: Vitest allows Remote Code Execution when accessing a malicious website while Vitest API server is listening"
url: https://erroneo.us/security/cve/CVE-2025-24964/
description: "CVE-2025-24964 (vitest (npm)): Vitest is a testing framework powered by Vite. Affected versions are subject to arbitrary remote Code Execution when…"
type: vulnerability-record
section: "Security Digest"
date_published: 2025-02-04
date_modified: 2025-02-12
publisher: erroneo.us
author: erroneo.us Security Desk
cve: "CVE-2025-24964"
kev: false
cvss: 9.7
epss: 0.00682
license: All rights reserved. Quote with attribution and a link.
---

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

**Signal:** Critical and remotely reachable. No known exploitation yet, but it is network-reachable without credentials. (Computed from CISA KEV, EPSS and CVSS; not an editorial verdict.)

## Should you act?

- Not in CISA KEV , but CISA’s SSVC assessment records a public proof-of-concept, so attack code exists.
- EPSS 0.7% , percentile 52: FIRST’s model estimates a 0.7% chance of exploitation activity in the next 30 days, higher than 52% of all scored CVEs (moderate). EPSS is a probability, not a verdict.
- Needs a user to click or open something. Phishing makes that realistic, but it is not wormable.
- Only applies if your dependency tree includes vitest (npm) >= 1.0.0, < 1.6.1, fixed in 1.6.1 ; vitest (npm) >= 2.0.0, < 2.1.9, fixed in 2.1.9 ; vitest (npm) >= 3.0.0, < 3.0.5, fixed in 3.0.5 ; vitest (npm) <= 0.0.125, no fixed version listed . Check your lockfile, including transitive dependencies.

## What it is

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 packages

- npm `vitest` >= 1.0.0, < 1.6.1 → fixed: 1.6.1
- npm `vitest` >= 2.0.0, < 2.1.9 → fixed: 2.1.9
- npm `vitest` >= 3.0.0, < 3.0.5 → fixed: 3.0.5
- npm `vitest` <= 0.0.125 → fixed: none listed

## Affected products (CVE record)

- vitest-dev vitest: <= 0.0.125, >= 1.0.0, < 1.6.1, >= 2.0.0, < 2.1.9, >= 3.0.0, < 3.0.5

## Severity

- GitHub_M CVSS 3.1: 9.7 `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 `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H`

## Exploitation

- CISA KEV: not listed (no confirmed in-the-wild exploitation known to CISA).
- CISA SSVC assessment: exploitation poc , automatable no , technical impact total .
- FIRST EPSS (model of 2026-10-21): 0.68% probability of exploitation activity in the next 30 days; percentile 52.

## Sources

- [GitHub Advisory GHSA-9crc-q9x8-hgqq](https://github.com/advisories/GHSA-9crc-q9x8-hgqq)
- [CVE.org record CVE-2025-24964](https://www.cve.org/CVERecord?id=CVE-2025-24964)
- [NVD entry CVE-2025-24964](https://nvd.nist.gov/vuln/detail/CVE-2025-24964)
- [github.com](https://github.com/vitest-dev/vitest/security/advisories/GHSA-9crc-q9x8-hgqq)
- [github.com](https://github.com/vitest-dev/vitest/blob/9a581e1c43e5c02b11e2a8026a55ce6a8cb35114/packages/vitest/src/api/setup.ts#L32-L46)
- [github.com](https://github.com/vitest-dev/vitest/blob/9a581e1c43e5c02b11e2a8026a55ce6a8cb35114/packages/vitest/src/api/setup.ts#L66-L76)
- [vitest.dev](https://vitest.dev/config/#api)
- [github.com](https://github.com/vitest-dev/vitest/commit/191ef9e34c867d0efd04f49b3d38193a68e825dc)
- [github.com](https://github.com/vitest-dev/vitest/commit/7ce9fbb4972d45c6fd34c843645ef6f549bbb241)
- [github.com](https://github.com/vitest-dev/vitest/commit/e0fe1d81e2d4bcddb1c6ca3c5c3970d8ba697383)

---
Source page: https://erroneo.us/security/cve/CVE-2025-24964/ · Security Digest: https://erroneo.us/security/ · More: https://erroneo.us/llms.txt
