1. Archivio CVE
  2. 2025
  3. CVE-2025-24964

CVE-2025-24964

8.8 Gravità alta CVSS v3.1 · fonte NVD CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H 8.8 – Alta

Descrizione

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.

Prodotti coinvolti

FornitoreProdottoVersionePiattaforma
vitest.dev vitest <= 0.0.125 node.js
vitest.dev vitest >= 1.0.0 < 1.6.1 node.js
vitest.dev vitest >= 2.0.0 < 2.1.9 node.js
vitest.dev vitest >= 3.0.0 < 3.0.5 node.js

Tipo di vulnerabilità

CWE-1385 Missing Origin Validation in WebSockets

The product uses a WebSocket, but it does not properly verify that the source of data or communication is valid.

Impatto sui sistemi

AmbitoImpatto
Riservatezza, Integrità, Disponibilità, Non ripudio, Controllo degli accessi Dipende dal contesto, Ottenere privilegi o assumere un’altra identità, Aggirare i meccanismi di protezione, Leggere i dati dell’applicazione, Modificare i dati dell’applicazione, Interruzione del servizio: arresto o riavvio

Come si previene

Sviluppo Enable CORS-like access restrictions by verifying the 'Origin' header during the WebSocket handshake.
Sviluppo Use a randomized CSRF token to verify requests.
Sviluppo Use TLS to securely communicate using 'wss' (WebSocket Secure) instead of 'ws'.
Architettura e progettazione · Sviluppo Require user authentication prior to the WebSocket connection being established. For example, the WS library in Node has a 'verifyClient' function.
Sviluppo Leverage rate limiting to prevent against DoS. Use of the leaky bucket algorithm can help with this.
Sviluppo Use a library that provides restriction of the payload size. For example, WS library for Node includes 'maxPayloadoption' that can be set.
Sviluppo Treat data/input as untrusted in both directions and apply the same data/input sanitization as XSS, SQLi, etc.

Le indicazioni di mitigazione sono riportate nella lingua originale del catalogo CWE del MITRE.

Tutte le 37 CVE di tipo CWE-1385, con andamento e prevenzione

Fonte: catalogo CWE del MITRE · cwe.mitre.org