Vulnerabilites related to vitest-dev - vitest
cve-2025-24964
Vulnerability from cvelistv5
Published
2025-02-04 19:36
Modified
2025-02-12 20:51
Severity ?
EPSS score ?
Summary
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.
References
Impacted products
Vendor | Product | Version | ||
---|---|---|---|---|
vitest-dev | vitest |
Version: <= 0.0.125 Version: >= 1.0.0, < 1.6.1 Version: >= 2.0.0, < 2.1.9 Version: >= 3.0.0, < 3.0.5 |
{ "containers": { "adp": [ { "metrics": [ { "other": { "content": { "id": "CVE-2025-24964", "options": [ { "Exploitation": "poc" }, { "Automatable": "no" }, { "Technical Impact": "total" } ], "role": "CISA Coordinator", "timestamp": "2025-02-04T19:45:47.197801Z", "version": "2.0.3" }, "type": "ssvc" } } ], "providerMetadata": { "dateUpdated": "2025-02-12T20:51:28.286Z", "orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "shortName": "CISA-ADP" }, "title": "CISA ADP Vulnrichment" } ], "cna": { "affected": [ { "product": "vitest", "vendor": "vitest-dev", "versions": [ { "status": "affected", "version": "\u003c= 0.0.125" }, { "status": "affected", "version": "\u003e= 1.0.0, \u003c 1.6.1" }, { "status": "affected", "version": "\u003e= 2.0.0, \u003c 2.1.9" }, { "status": "affected", "version": "\u003e= 3.0.0, \u003c 3.0.5" } ] } ], "descriptions": [ { "lang": "en", "value": "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." } ], "metrics": [ { "cvssV3_1": { "attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.7, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H", "version": "3.1" } } ], "problemTypes": [ { "descriptions": [ { "cweId": "CWE-1385", "description": "CWE-1385: Missing Origin Validation in WebSockets", "lang": "en", "type": "CWE" } ] } ], "providerMetadata": { "dateUpdated": "2025-02-04T19:36:50.509Z", "orgId": "a0819718-46f1-4df5-94e2-005712e83aaa", "shortName": "GitHub_M" }, "references": [ { "name": "https://github.com/vitest-dev/vitest/security/advisories/GHSA-9crc-q9x8-hgqq", "tags": [ "x_refsource_CONFIRM" ], "url": "https://github.com/vitest-dev/vitest/security/advisories/GHSA-9crc-q9x8-hgqq" }, { "name": "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#L32-L46" }, { "name": "https://github.com/vitest-dev/vitest/blob/9a581e1c43e5c02b11e2a8026a55ce6a8cb35114/packages/vitest/src/api/setup.ts#L66-L76", "tags": [ "x_refsource_MISC" ], "url": "https://github.com/vitest-dev/vitest/blob/9a581e1c43e5c02b11e2a8026a55ce6a8cb35114/packages/vitest/src/api/setup.ts#L66-L76" }, { "name": "https://vitest.dev/config/#api", "tags": [ "x_refsource_MISC" ], "url": "https://vitest.dev/config/#api" } ], "source": { "advisory": "GHSA-9crc-q9x8-hgqq", "discovery": "UNKNOWN" }, "title": "Remote Code Execution when accessing a malicious website while Vitest API server is listening" } }, "cveMetadata": { "assignerOrgId": "a0819718-46f1-4df5-94e2-005712e83aaa", "assignerShortName": "GitHub_M", "cveId": "CVE-2025-24964", "datePublished": "2025-02-04T19:36:50.509Z", "dateReserved": "2025-01-29T15:18:03.209Z", "dateUpdated": "2025-02-12T20:51:28.286Z", "state": "PUBLISHED" }, "dataType": "CVE_RECORD", "dataVersion": "5.1" }
cve-2025-24963
Vulnerability from cvelistv5
Published
2025-02-04 19:36
Modified
2025-02-12 20:51
Severity ?
EPSS score ?
Summary
Vitest is a testing framework powered by Vite. The `__screenshot-error` handler on the browser mode HTTP server that responds any file on the file system. Especially if the server is exposed on the network by `browser.api.host: true`, an attacker can send a request to that handler from remote to get the content of arbitrary files.This `__screenshot-error` handler on the browser mode HTTP server responds any file on the file system. This code was added by commit `2d62051`. Users explicitly exposing the browser mode server to the network by `browser.api.host: true` may get any files exposed. This issue has been addressed in versions 2.1.9 and 3.0.4. Users are advised to upgrade. There are no known workarounds for this vulnerability.
References
Impacted products
Vendor | Product | Version | ||
---|---|---|---|---|
vitest-dev | vitest |
Version: >= 2.0.4, < 2.1.9 Version: >= 3.0.0, < 3.0.4 |
{ "containers": { "adp": [ { "metrics": [ { "other": { "content": { "id": "CVE-2025-24963", "options": [ { "Exploitation": "poc" }, { "Automatable": "no" }, { "Technical Impact": "total" } ], "role": "CISA Coordinator", "timestamp": "2025-02-04T19:44:40.367761Z", "version": "2.0.3" }, "type": "ssvc" } } ], "providerMetadata": { "dateUpdated": "2025-02-12T20:51:28.011Z", "orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "shortName": "CISA-ADP" }, "title": "CISA ADP Vulnrichment" } ], "cna": { "affected": [ { "product": "vitest", "vendor": "vitest-dev", "versions": [ { "status": "affected", "version": "\u003e= 2.0.4, \u003c 2.1.9" }, { "status": "affected", "version": "\u003e= 3.0.0, \u003c 3.0.4" } ] } ], "descriptions": [ { "lang": "en", "value": "Vitest is a testing framework powered by Vite. The `__screenshot-error` handler on the browser mode HTTP server that responds any file on the file system. Especially if the server is exposed on the network by `browser.api.host: true`, an attacker can send a request to that handler from remote to get the content of arbitrary files.This `__screenshot-error` handler on the browser mode HTTP server responds any file on the file system. This code was added by commit `2d62051`. Users explicitly exposing the browser mode server to the network by `browser.api.host: true` may get any files exposed. This issue has been addressed in versions 2.1.9 and 3.0.4. Users are advised to upgrade. There are no known workarounds for this vulnerability." } ], "metrics": [ { "cvssV3_1": { "attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.9, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N", "version": "3.1" } } ], "problemTypes": [ { "descriptions": [ { "cweId": "CWE-22", "description": "CWE-22: Improper Limitation of a Pathname to a Restricted Directory (\u0027Path Traversal\u0027)", "lang": "en", "type": "CWE" } ] } ], "providerMetadata": { "dateUpdated": "2025-02-04T19:36:52.385Z", "orgId": "a0819718-46f1-4df5-94e2-005712e83aaa", "shortName": "GitHub_M" }, "references": [ { "name": "https://github.com/vitest-dev/vitest/security/advisories/GHSA-8gvc-j273-4wm5", "tags": [ "x_refsource_CONFIRM" ], "url": "https://github.com/vitest-dev/vitest/security/advisories/GHSA-8gvc-j273-4wm5" }, { "name": "https://github.com/vitest-dev/vitest/commit/2d62051f13b4b0939b2f7e94e88006d830dc4d1f", "tags": [ "x_refsource_MISC" ], "url": "https://github.com/vitest-dev/vitest/commit/2d62051f13b4b0939b2f7e94e88006d830dc4d1f" }, { "name": "https://github.com/vitest-dev/vitest/blob/f17918a79969d27a415f70431e08a9445b051e45/packages/browser/src/node/plugin.ts#L88-L130", "tags": [ "x_refsource_MISC" ], "url": "https://github.com/vitest-dev/vitest/blob/f17918a79969d27a415f70431e08a9445b051e45/packages/browser/src/node/plugin.ts#L88-L130" }, { "name": "https://vitest.dev/guide/browser/config.html#browser-api", "tags": [ "x_refsource_MISC" ], "url": "https://vitest.dev/guide/browser/config.html#browser-api" } ], "source": { "advisory": "GHSA-8gvc-j273-4wm5", "discovery": "UNKNOWN" }, "title": "Browser mode serves arbitrary files in vitest" } }, "cveMetadata": { "assignerOrgId": "a0819718-46f1-4df5-94e2-005712e83aaa", "assignerShortName": "GitHub_M", "cveId": "CVE-2025-24963", "datePublished": "2025-02-04T19:36:52.385Z", "dateReserved": "2025-01-29T15:18:03.209Z", "dateUpdated": "2025-02-12T20:51:28.011Z", "state": "PUBLISHED" }, "dataType": "CVE_RECORD", "dataVersion": "5.1" }