Vitest Browser Mode CVE-2026-53633
CRITICALSeverity by source
AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Network-reachable RCE with no auth, but AC:H because exploitation requires a non-default network bind and an active browser session; S:C since browser-scope CDP bypass yields host-OS code execution.
Primary rating from GitHub Advisory.
CVSS VectorGitHub Advisory
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Lifecycle Timeline
3Blast Radius
ecosystem impact- 11 npm packages depend on vite-plus (9 direct, 2 indirect)
Ecosystem-wide dependent count for version 0.1.24.
DescriptionGitHub Advisory
Summary
Vitest Browser Mode exposes a cdp() API that forwards raw Chrome DevTools Protocol (CDP) methods over the Vitest browser WebSocket RPC. CDP is not gated by browser.api.allowWrite, browser.api.allowExec, api.allowWrite, or api.allowExec.
As a result, disabling Browser Mode write and exec operations does not prevent a browser API client from using CDP to perform equivalent actions. In a verified reproduction with allowWrite: false and allowExec: false, CDP Page.setDownloadBehavior set the browser download directory to the project root, and CDP Runtime.evaluate downloaded a controlled vite.config.ts. Vitest reloaded the changed config and executed attacker-controlled Node.js code.
When the Browser Mode API is also exposed to the network, this becomes remotely exploitable because the generated browser runner page exposes the API token, active session id, project name, and project root path needed to connect to the browser WebSocket API and select the target download directory.
Impact
This affects Browser Mode projects using a CDP-capable provider, such as Playwright Chromium, when the browser API server is exposed to the network, for example with --browser.api.host=0.0.0.0.
In this mode Vitest warns that write and exec operations are disabled by default, but the generated browser runner page exposes enough metadata for a remote client to authenticate to the browser WebSocket API while an active session exists. This includes the browser API token, active session id, project name, and serialized test config including the project root path. The attacker can then call Vitest's CDP RPC and use Chrome's download controls to overwrite vite.config.ts in the project root. When Vitest reloads the changed config, attacker-controlled Node.js code executes on the host running Vitest.
The same exposed CDP bridge also allows direct browser-session JavaScript execution through Runtime.evaluate. A separate local probe showed that CDP can navigate the browser to a file:// URL and read rendered file contents, but the primary verified impact is config-file overwrite leading to RCE.
Reproduction
For a concrete reproduction, start Browser Mode in watch mode using the official Lit example:
pnpm dlx tiged vitest-dev/vitest/examples/lit vitest-poc
cd vitest-poc
pnpm installConfigure the Browser Mode API to listen on all interfaces while explicitly disabling write and exec operations:
import { playwright } from '@vitest/browser-playwright'
import { defineConfig } from 'vite'
export default defineConfig({
test: {
browser: {
enabled: true,
provider: playwright(),
instances: [
{ browser: 'chromium' },
],
api: {
host: '0.0.0.0',
allowWrite: false,
allowExec: false,
},
},
},
})Then start the test server:
pnpm testVitest serves the browser runner HTML and WebSocket API at http://localhost:63315.
While the browser session is active:
- Fetch the generated browser runner page:
http://localhost:63315/__vitest_test__/- Extract the embedded browser API token, active session id, project name, and project root:
window.VITEST_API_TOKEN__vitest_browser_runner__.sessionId__vitest_browser_runner__.config.name__vitest_browser_runner__.config.root
- Connect to the browser API WebSocket as a tester client:
/__vitest_browser_api__?type=tester&rpcId=<fresh-id>&sessionId=<session-id>&projectName=<project-name>&method=none&token=<token>- Call the
sendCdpEventRPC method with:
Page.setDownloadBehavior({
behavior: "allow",
downloadPath: __vitest_browser_runner__.config.root
})- Call
sendCdpEventagain withRuntime.evaluate. The evaluated JavaScript creates a Blob containing a malicious Vite config and clicks an anchor element<a download="vite.config.ts">. - Observed result:
vite.config.tsis overwritten with attacker-controlled content.- Vitest reloads the changed config.
- The injected Node.js payload runs on the host.
Articles & Coverage 1
AnalysisAI
Remote code execution in Vitest Browser Mode (npm @vitest/browser 3.0.0-3.2.4, 4.0.0-4.1.7, 5.0.0-beta.0-5.0.0-beta.3) allows remote attackers to overwrite the project's vite.config.ts and execute arbitrary Node.js code on the host when the browser API server is bound to a network-reachable interface (e.g. --browser.api.host=0.0.0.0). …
Unlock full vulnerability intelligence
- Risk assessment & exploitation conditions
- Attack chain visualization
- Remediation with exact patch versions
- Threat intelligence from 22 sources
- Personal watchlist & email alerts
Free forever · No credit card required
Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata
Vulnerability AssessmentAI
| Exploitation | Requires: (1) a Vitest project running Browser Mode (test.browser.enabled=true) with a CDP-capable provider, specifically Playwright Chromium; (2) the browser API server bound to a network-reachable interface such as browser.api.host='0.0.0.0' (the default localhost bind is not directly exploitable from off-host); (3) an active browser test session at the time of attack so VITEST_API_TOKEN, sessionId, project name and root are exposed on /__vitest_test__/; (4) network reachability from the attacker to the Vitest port (default 63315). … Additional conditions and limiting factors are described in the full assessment. |
| Risk Assessment | The vendor CVSS 3.1 vector AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H (9.8) reflects unauthenticated network RCE, and the published GHSA reproduction backs that with concrete steps - publicly available exploit code exists, which is a meaningful signal even without a KEV listing. … Full risk analysis with EPSS, KEV, and SSVC signal comparison available after sign-in. |
| Exploit Scenario | A developer runs Vitest Browser Mode in watch mode with --browser.api.host=0.0.0.0 on a laptop joined to a coffee-shop or corporate Wi-Fi; an attacker on the same network fetches /__vitest_test__/, scrapes VITEST_API_TOKEN, sessionId, project name and root, then opens a WebSocket to /__vitest_browser_api__ as a tester client. Using sendCdpEvent the attacker calls Page.setDownloadBehavior to point downloads at the project root and Runtime.evaluate to trigger an anchor-click download of a malicious vite.config.ts; Vitest's watcher reloads the new config and executes attacker-controlled Node.js on the host. … |
| Remediation | Upgrade to the vendor-released patched versions: @vitest/browser 3.2.5 for the 3.x line, 4.1.8 for the 4.x line, or 5.0.0-beta.4 for the 5.x beta line, and vite-plus 0.1.24, per https://github.com/vitest-dev/vitest/security/advisories/GHSA-g8mr-85jm-7xhm. … Detailed patch versions, workarounds, and compensating controls in full report. |
Recommended ActionAI
Within 24 hours: (1) Scan all development and CI systems to identify @vitest/browser versions 3.0.0-3.2.4, 4.0.0-4.1.7, or 5.0.0-beta.0-5.0.0-beta.3 using automated dependency scanning; (2) Verify browser API binding configuration on all systems-audit and enforce that --browser.api.host is set to localhost (127.0.0.1) only, never to 0.0.0.0 or external-facing addresses; (3) Isolate affected build infrastructure from untrusted networks. …
Sign in for detailed remediation steps and compensating controls.
Threat intelligence, references, and detailed analysis are available after sign-in.
More from same product – last 7 days
Denial of service in the image-size Node.js library through version 2.0.2 allows remote unauthenticated attackers to per
Denial of service in the image-size Node.js library (versions up to and including 2.0.2) allows remote unauthenticated a
Remote prototype pollution in i18next-http-middleware before 3.9.7 allows unauthenticated attackers to write to Object.p
Prototype pollution in ApostropheCMS versions up to and including 4.30.0 allows an authenticated editor to poison Object
Code injection in OpenZeppelin Contracts Wizard's `@openzeppelin/wizard` npm package (<=0.10.8) allows attacker-supplied
Share
External POC / Exploit Code
Leaving vuln.today
GHSA-g8mr-85jm-7xhm