Severity 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 Vendor (https://github.com/vitest-dev/vitest).
CVSS VectorVendor: https://github.com/vitest-dev/vitest
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.
DescriptionCVE.org
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). The flaw stems from the cdp() API forwarding raw Chrome DevTools Protocol calls over the browser WebSocket RPC without honoring the allowWrite/allowExec gates that normally restrict Browser Mode. Publicly available exploit code exists in the GHSA-g8mr-85jm-7xhm advisory's step-by-step reproduction, though no CISA KEV listing has been issued.
Technical ContextAI
Vitest is a Vite-native JavaScript test runner; its Browser Mode runs tests inside a real browser driven by a CDP-capable provider such as Playwright Chromium. The vulnerable surface is the @vitest/browser package's cdp() helper, which proxies arbitrary Chrome DevTools Protocol methods (Page.setDownloadBehavior, Runtime.evaluate, etc.) through a WebSocket RPC endpoint at /__vitest_browser_api__. This maps to CWE-749 (Exposed Dangerous Method or Function): a powerful internal API is reachable without the authorization checks applied to neighboring write/exec features, so the security policy 'allowWrite:false, allowExec:false' is silently bypassed for any operation routed through CDP. The generated runner page at /__vitest_test__/ additionally leaks VITEST_API_TOKEN, sessionId, project name, and root path, providing all material needed to authenticate to the WebSocket RPC.
RemediationAI
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. Until patched, the highest-leverage mitigation is to stop binding the Browser Mode API to non-loopback interfaces - remove --browser.api.host=0.0.0.0 and any equivalent test.browser.api.host setting so the WebSocket RPC is reachable only on localhost (side effect: remote browser/CI scenarios that intentionally relied on the network bind will need an SSH tunnel or reverse proxy with its own auth). For developers who must expose the port, restrict it with a host firewall to known tester IPs and avoid running Vitest Browser Mode on shared/multi-tenant hosts; also make vite.config.ts read-only or run tests in an ephemeral container so a config overwrite does not yield persistent host code execution. Switching to a non-CDP provider (e.g. preview/webdriver-based) removes the cdp() attack path but at the cost of losing Playwright/Chromium-specific features.
A vulnerability in the NuPoint Unified Messaging (NPM) component of Mitel MiCollab through 9.8 SP1 FP2 (9.8.1.201) could
FortiOS and FortiProxy contain an authentication bypass via the Node.js websocket module allowing unauthenticated remote
Eval injection vulnerability in the internals.batch function in lib/batch.js in the bassmaster plugin before 1.5.2 for t
Flowise version 3.0.5 contains a remote code execution vulnerability in the CustomMCP node. The mcpServerConfig paramete
Node.js 8.5.0 before 8.6.0 allows remote attackers to access unintended files, because a change to ".." handling was inc
An issue was discovered in the node-serialize package 0.0.4 for Node.js. Rated critical severity (CVSS 9.8), this vulner
Directory traversal vulnerability in the st module before 0.2.5 for Node.js allows remote attackers to read arbitrary fi
Multiple SQL injection vulnerabilities in the Manage Accounts page in the AccountManagement.asmx service in the Solarwin
The JS-YAML module before 2.0.5 for Node.js parses input without properly considering the unsafe !!js/function tag, whic
Directory traversal vulnerability in lib/app/index.js in Geddy before 13.0.8 for Node.js allows remote attackers to read
Credential-harvesting malware compromised 84 versions of 42 TanStack npm packages on 2026-05-11 via chained GitHub Actio
Eval injection vulnerability in index.js in the syntax-error package before 1.1.1 for Node.js 0.10.x, as used in IBM Rat
Same weakness CWE-749 – Exposed Dangerous Method or Function
View allSame technique Code Injection
View allVendor StatusVendor
Share
External POC / Exploit Code
Leaving vuln.today
EUVD-2026-44403
GHSA-g8mr-85jm-7xhm