{"answers":{"affected":"8 open source packages ship an affected version, including vitest. It affects 1 product.","exploited":"It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-24964 exists.","fix":"Upgrade vitest to a fixed version for your release line: 1.6.1, 2.1.9 or 3.0.5.","what":"CVE-2025-24964 is a critical vulnerability in vitest-dev vitest, published on 4 Feb 2025. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link."},"fix_prompt":"Check this codebase for CVE-2025-24964 and fix it if it is affected.\n\nWhat it is: CVE-2025-24964 is a critical vulnerability in vitest-dev vitest, published on 4 Feb 2025. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.\nExploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-24964 exists.\n\nAffected packages and fixed versions:\n- vitest (npm): affected all versions up to 0.0.125; no fix listed\n- vitest (npm): affected all versions up to 0.0.125; no fix listed\n- vitest (npm): affected from 1.0.0; fixed in 1.6.1\n- vitest (npm): affected from 1.0.0; fixed in 1.6.1\n- vitest (npm): affected from 2.0.0; fixed in 2.1.9\n- vitest (npm): affected from 2.0.0; fixed in 2.1.9\n- vitest (npm): affected from 3.0.0; fixed in 3.0.5\n- vitest (npm): affected from 3.0.0; fixed in 3.0.5\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/CVE-2025-24964/ (Markdown: https://insights.sbomify.com/CVE-2025-24964/index.md)","id":"CVE-2025-24964","markdown":"https://insights.sbomify.com/CVE-2025-24964/index.md","name":"CVE-2025-24964","record":{"aliases":["GHSA-9crc-q9x8-hgqq","ROOT-APP-NPM-CVE-2025-24964"],"analysis":{"component_type":"developer_tool","fix_type":"upgrade","impacts":["code_execution"],"network_reachable":"yes","non_default_config":true,"product_category":"Vitest testing framework","requires_auth":"none","summary":"Attackers can execute arbitrary code via Cross-site WebSocket Hijacking if the Vitest API server is enabled and lacks origin checks.","user_interaction":"required","vuln_class":"csrf"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"GitHub_M","cpe":[{"product":"vitest","vendor":"vitest.dev"}],"cvss":{"score":9.7,"severity":"critical","source":"cna","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H","version":"3.1"},"cwes":[{"id":"CWE-1385","name":"Missing Origin Validation in WebSockets"}],"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.","ecosystems":["npm"],"exploits":{"exploitdb":0,"first_seen":null,"github_poc":0,"max_poc_stars":null,"metasploit":0,"nuclei":0,"refs":[],"tier":"weaponised"},"has_fix":true,"headline":"Remote Code Execution when accessing a malicious website while Vitest API server is listening","id":"CVE-2025-24964","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":"npm","product":null,"products":[],"type":"csrf","year":"2025"},"n_packages":8,"n_references":4,"next":{"headline":".krun_config.json symlink attack creates or overwrites file on the host in crun","id":"CVE-2025-24965"},"packages":[{"ecosystem":"npm","fixed":[],"introduced":["0"],"last_affected":["0.0.125"],"package":"vitest","purl":null,"source":"GHSA-9crc-q9x8-hgqq"},{"ecosystem":"npm","fixed":[],"introduced":["0"],"last_affected":["0.0.125"],"package":"vitest","purl":"pkg:npm/vitest","source":"GHSA-9crc-q9x8-hgqq"},{"ecosystem":"npm","fixed":["1.6.1"],"introduced":["1.0.0"],"last_affected":[],"package":"vitest","purl":null,"source":"GHSA-9crc-q9x8-hgqq"},{"ecosystem":"npm","fixed":["1.6.1"],"introduced":["1.0.0"],"last_affected":[],"package":"vitest","purl":"pkg:npm/vitest","source":"GHSA-9crc-q9x8-hgqq"},{"ecosystem":"npm","fixed":["2.1.9"],"introduced":["2.0.0"],"last_affected":[],"package":"vitest","purl":null,"source":"GHSA-9crc-q9x8-hgqq"},{"ecosystem":"npm","fixed":["2.1.9"],"introduced":["2.0.0"],"last_affected":[],"package":"vitest","purl":"pkg:npm/vitest","source":"GHSA-9crc-q9x8-hgqq"},{"ecosystem":"npm","fixed":["3.0.5"],"introduced":["3.0.0"],"last_affected":[],"package":"vitest","purl":null,"source":"GHSA-9crc-q9x8-hgqq"},{"ecosystem":"npm","fixed":["3.0.5"],"introduced":["3.0.0"],"last_affected":[],"package":"vitest","purl":"pkg:npm/vitest","source":"GHSA-9crc-q9x8-hgqq"}],"prev":{"headline":"Browser mode serves arbitrary files in vitest","id":"CVE-2025-24963"},"products":["vitest"],"published":"2025-02-04","related":[{"cvss_score":9.8,"headline":"Vitest: Arbitrary file can be read and executed when Vitest UI server is listening","id":"CVE-2026-47429","kev_date_added":null,"published":"2026-07-14"},{"cvss_score":5.9,"headline":"Browser mode serves arbitrary files in vitest","id":"CVE-2025-24963","kev_date_added":null,"published":"2025-02-04"}],"sources":[{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"US public information, NVD API terms","name":"NVD"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"}],"ssvc":{"automatable":"no","exploitation":"poc","technical_impact":"total"},"state":"PUBLISHED","updated":"2025-02-12","vendors":["vitest-dev"]},"summary":"Attackers can execute arbitrary code via Cross-site WebSocket Hijacking if the Vitest API server is enabled and lacks origin checks.","url":"https://insights.sbomify.com/CVE-2025-24964/"}