{"cve":"CVE-2025-24964","nvd":{"published":"2025-02-04T20:15:50.483","modified":"2026-06-17T08:59:53.550","status":"Analyzed","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.","cvss_v4":null,"cvss_v3":{"version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","score":8.8},"cwes":["CWE-1385"],"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#L66-L76","https://github.com/vitest-dev/vitest/security/advisories/GHSA-9crc-q9x8-hgqq","https://vitest.dev/config/#api"],"products":["vitest.dev:vitest"],"source":"nvd","synced_at":"2026-10-19T21:59:18.731010617+00:00"},"epss":{"cve":"CVE-2025-24964","score":0.00682,"percentile":0.52478,"date":"2026-10-31"},"kev":null,"osv":[{"id":"GHSA-9crc-q9x8-hgqq","url":"https://osv.dev/vulnerability/GHSA-9crc-q9x8-hgqq","summary":"Vitest allows Remote Code Execution when accessing a malicious website while Vitest API server is listening","modified":"2025-02-04T22:04:09Z","packages":[{"ecosystem":"npm","name":"vitest","purl":"pkg:npm/vitest","ranges":[">=1.0.0 <1.6.1"],"fixed":["1.6.1"]},{"ecosystem":"npm","name":"vitest","purl":"pkg:npm/vitest","ranges":[">=2.0.0 <2.1.9"],"fixed":["2.1.9"]},{"ecosystem":"npm","name":"vitest","purl":"pkg:npm/vitest","ranges":[">=3.0.0 <3.0.5"],"fixed":["3.0.5"]},{"ecosystem":"npm","name":"vitest","purl":"pkg:npm/vitest","ranges":["<=0.0.125"],"fixed":[]}]}],"attribution":["This product uses the NVD API but is not endorsed or certified by the NVD.","EPSS scores: FIRST Exploit Prediction Scoring System, https://www.first.org/epss","Known exploited vulnerabilities: CISA Known Exploited Vulnerabilities Catalog, https://www.cisa.gov/known-exploited-vulnerabilities-catalog","Package advisories: OSV (https://osv.dev), from the GitHub Advisory Database, PyPA, Go, RustSec and other ecosystem databases, under CC-BY 4.0 or CC0","CVE records: the CVE Program's CVE List (https://www.cve.org), under its terms of use (https://www.cve.org/Legal/TermsOfUse). CVE is a registered trademark of The MITRE Corporation; this product is not affiliated with the CVE Program."]}