{"id":"CVE-2025-24964","published":"2025-02-04T19:36:50Z","modified":"2025-02-12T20:51:28Z","title":"Remote Code Execution when accessing a malicious website while Vitest API server is listening","vendor":"vitest-dev","product":"vitest","tier":"tail","description":{"text":"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.","provenance":"source","from":"CVE.org"},"cvss":{"score":9.7,"severity":"CRITICAL","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00677,"percentile":0.53216,"provenance":"source"},"cwes":[{"id":"CWE-1385","name":"Missing Origin Validation in WebSockets"}],"references":[{"url":"https://github.com/vitest-dev/vitest/security/advisories/GHSA-9crc-q9x8-hgqq","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/vitest-dev/vitest/blob/9a581e1c43e5c02b11e2a8026a55ce6a8cb35114/packages/vitest/src/api/setup.ts#L32-L46","tags":["x_refsource_MISC"]},{"url":"https://github.com/vitest-dev/vitest/blob/9a581e1c43e5c02b11e2a8026a55ce6a8cb35114/packages/vitest/src/api/setup.ts#L66-L76","tags":["x_refsource_MISC"]},{"url":"https://vitest.dev/config/#api","tags":["x_refsource_MISC"]}],"priority":{"score":17.4,"factors":[{"name":"EPSS percentile","points":10.64},{"name":"CVSS severity","points":6.79}]},"vendorSlug":"vitest-dev","affectedVersions":[{"vendor":"vitest-dev","product":"vitest","versions":["<= 0.0.125",">= 1.0.0, < 1.6.1",">= 2.0.0, < 2.1.9",">= 3.0.0, < 3.0.5"]}],"ssvc":{"exploitation":"poc","automatable":"no","technicalImpact":"total","timestamp":"2025-02-04T19:45:47.197801Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"npm","package":"vitest","vulnerableRanges":[">=1.0.0, <1.6.1",">=2.0.0, <2.1.9",">=3.0.0, <3.0.5","<=0.0.125"],"patched":["1.6.1","2.1.9","3.0.5"],"from":["GHSA-9crc-q9x8-hgqq"],"provenance":"source"}],"summary":{"text":"The Vitest testing framework, when its API server is enabled (as the Vitest UI does), exposes a WebSocket server that did not validate the Origin header or require any authorization, leaving it open to cross-site WebSocket hijacking. An attacker who can get a user to visit a malicious website while the API server is listening can use the saveTestFile and rerun APIs to inject code into a test file and execute it, requiring only that the victim visit the site (user interaction) with no authentication or prior network access.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T20:35:41Z"},"euvd":{"id":"EUVD-2025-0225","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-vitest-dev-vitest-cve-2025-24963","children":[{"from":"CVE-2025-24964","to":"CVE-2026-47429","relation":"successor","confidence":"high","kind":"lineage","evidence":[{"kind":"version-step","provenance":"source","package":"npm:vitest","fromFixed":"3.0.5","toFixed":"3.2.6","daysApart":525},{"kind":"same-code","provenance":"machine","files":["packages/vitest/src/api/setup.ts","packages/vitest/src/node/types/config.ts"],"commits":["https://github.com/vitest-dev/vitest/commit/191ef9e34c867d0efd04f49b3d38193a68e825dc","https://github.com/vitest-dev/vitest/commit/7ce9fbb4972d45c6fd34c843645ef6f549bbb241","https://github.com/vitest-dev/vitest/commit/20e00ef7808de6d330c5e2fda530f686e08f1c8d","https://github.com/vitest-dev/vitest/commit/af88b1f5d82844a4761ea9a977156c98e2b14ca8"],"basis":"shared function","functions":["setup"]}]},{"from":"CVE-2025-24964","to":"CVE-2026-47428","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["packages/browser/src/node/serverOrchestrator.ts"],"commits":["https://github.com/vitest-dev/vitest/commit/191ef9e34c867d0efd04f49b3d38193a68e825dc","https://github.com/vitest-dev/vitest/commit/7ce9fbb4972d45c6fd34c843645ef6f549bbb241","https://github.com/vitest-dev/vitest/commit/18af98cee1830604d57f6a02bf28f8067cdffc06","https://github.com/vitest-dev/vitest/commit/3514f9fa135c90e1c35754fc4d27c9cf351faafa"],"basis":"shared function","functions":["resolveOrchestrator"]}]},{"from":"CVE-2025-24964","to":"CVE-2026-73653","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["packages/browser/src/node/index.ts"],"commits":["https://github.com/vitest-dev/vitest/commit/191ef9e34c867d0efd04f49b3d38193a68e825dc","https://github.com/vitest-dev/vitest/commit/7ce9fbb4972d45c6fd34c843645ef6f549bbb241","https://github.com/vitest-dev/vitest/commit/33f96a145ef09ca6a43b4e555eb273e64a87be23","https://github.com/vitest-dev/vitest/commit/5c18dd267ff7f47f24cab2f615a16b37d90feb7f"],"basis":"rarely changed file"}]},{"from":"CVE-2025-24964","to":"CVE-2026-84373","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["packages/browser/src/node/index.ts"],"commits":["https://github.com/vitest-dev/vitest/commit/191ef9e34c867d0efd04f49b3d38193a68e825dc","https://github.com/vitest-dev/vitest/commit/7ce9fbb4972d45c6fd34c843645ef6f549bbb241","https://github.com/vitest-dev/vitest/commit/51edf2b072902aec6d30c90ebaafd8f121c6f9d8","https://github.com/vitest-dev/vitest/commit/8ff9b9a9efca7c6cfd5243569440de8d7a33aec4"],"basis":"rarely changed file"}]}],"packageHistory":[{"cve":"CVE-2025-24964","published":"2025-02-04","fixed":"3.0.5","kev":false},{"cve":"CVE-2026-47429","published":"2026-07-14","fixed":"4.1.0","kev":false},{"cve":"CVE-2026-84373","published":"2026-09-01","fixed":"5.0.0-rc.2","kev":false}],"package":"npm:vitest"}}