CVE-2025-24964

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

Configuration 1 (hide)

OR cpe:2.3:a:vitest.dev:vitest:*:*:*:*:*:node.js:*:*
cpe:2.3:a:vitest.dev:vitest:*:*:*:*:*:node.js:*:*
cpe:2.3:a:vitest.dev:vitest:*:*:*:*:*:node.js:*:*
cpe:2.3:a:vitest.dev:vitest:*:*:*:*:*:node.js:*:*

History

31 Dec 2025, 14:50

Type Values Removed Values Added
CPE cpe:2.3:a:vitest.dev:vitest:*:*:*:*:*:node.js:*:*
First Time Vitest.dev vitest
Vitest.dev
Summary
  • (es) Vitest es un servidor de pruebas framework desarrollado por Vite. Las versiones afectadas están sujetas a la ejecución remota de código arbitrario cuando se accede a un sitio web malicioso mientras el servidor API de Vitest está escuchando mediante ataques de Cross-site WebSocket hijacking (CSWSH). Cuando la opción `api` está habilitada (la interfaz de usuario de Vitest la habilita), Vitest inicia un servidor WebSocket. Este servidor WebSocket no verificaba el encabezado Origin y no tenía ningún mecanismo de autorización y era vulnerable a ataques CSWSH. Este servidor WebSocket tiene la API `saveTestFile` que puede editar un archivo de prueba y la API `rerun` que puede volver a ejecutar las pruebas. Un atacante puede ejecutar código arbitrario inyectando un código en un archivo de prueba mediante la API `saveTestFile` y luego ejecutando ese archivo llamando a la API `rerun`. Esta vulnerabilidad puede resultar en la ejecución remota de código para los usuarios que usan la API de servicio de Vitest. Este problema se ha corregido en las versiones 1.6.1, 2.1.9 y 3.0.5. Se recomienda a los usuarios que actualicen. No se conocen workarounds para esta vulnerabilidad.
References () https://github.com/vitest-dev/vitest/blob/9a581e1c43e5c02b11e2a8026a55ce6a8cb35114/packages/vitest/src/api/setup.ts#L32-L46 - () https://github.com/vitest-dev/vitest/blob/9a581e1c43e5c02b11e2a8026a55ce6a8cb35114/packages/vitest/src/api/setup.ts#L32-L46 - Product
References () https://github.com/vitest-dev/vitest/blob/9a581e1c43e5c02b11e2a8026a55ce6a8cb35114/packages/vitest/src/api/setup.ts#L66-L76 - () https://github.com/vitest-dev/vitest/blob/9a581e1c43e5c02b11e2a8026a55ce6a8cb35114/packages/vitest/src/api/setup.ts#L66-L76 - Product
References () https://github.com/vitest-dev/vitest/security/advisories/GHSA-9crc-q9x8-hgqq - () https://github.com/vitest-dev/vitest/security/advisories/GHSA-9crc-q9x8-hgqq - Exploit, Vendor Advisory
References () https://vitest.dev/config/#api - () https://vitest.dev/config/#api - Product

04 Feb 2025, 20:15

Type Values Removed Values Added
New CVE

Information

Published : 2025-02-04 20:15

Updated : 2025-12-31 14:50


NVD link : CVE-2025-24964

Mitre link : CVE-2025-24964

CVE.ORG link : CVE-2025-24964


JSON object : View

Products Affected

vitest.dev

  • vitest
CWE
CWE-1385

Missing Origin Validation in WebSockets