Loading...
Skip to main content

CVE-2026-53633 — Vulnerability in @vitest/browser — CVE Details

CRITICAL

Vitest Browser: Exposed Browser Mode API Can Proxy CDP and Overwrite Config Files, Leading to RCE

Published June 15, 2026Updated August 13, 2026Source: osv

Summary

## 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: ```sh pnpm dlx tiged vitest-dev/vitest/examples/lit vitest-poc cd vitest-poc pnpm install ``` Configure the Browser Mode API to listen on all interfaces while explicitly disabling write and exec operations: ```ts 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: ```sh pnpm test ``` Vitest serves the browser runner HTML and WebSocket API at `http://localhost:63315`. While the browser session is active: 1. Fetch the generated browser runner page: ```text http://localhost:63315/__vitest_test__/ ``` 2. 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` 3. Connect to the browser API WebSocket as a tester client: ```text /__vitest_browser_api__?type=tester&rpcId=<fresh-id>&sessionId=<session-id>&projectName=<project-name>&method=none&token=<token> ``` 4. Call the `sendCdpEvent` RPC method with: ```text Page.setDownloadBehavior({ behavior: "allow", downloadPath: __vitest_browser_runner__.config.root }) ``` 5. Call `sendCdpEvent` again with `Runtime.evaluate`. The evaluated JavaScript creates a Blob containing a malicious Vite config and clicks an anchor element `<a download="vite.config.ts">`. 6. Observed result: - `vite.config.ts` is overwritten with attacker-controlled content. - Vitest reloads the changed config. - The injected Node.js payload runs on the host.

Advisory Timeline

  • First published June 15, 2026 (119 days ago).
  • Last revised August 13, 2026 — 59 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

npm
Update @vitest/browser to 4.1.8 or later
npm install @vitest/browser@4.1.8
npm
Update vite-plus to 0.1.24 or later
npm install vite-plus@0.1.24
npm
Update @vitest/browser to 3.2.5 or later
npm install @vitest/browser@3.2.5
npm
Update @vitest/browser to 5.0.0-beta.4 or later
npm install @vitest/browser@5.0.0-beta.4

After upgrading, run your dependency scanner again to confirm the vulnerability is resolved.

Affected Packages (4)

Affects 1 ecosystem: npm (2).

PackageEcosystemAffectedFixed In
@vitest/browser
npm
All versions4.1.8
vite-plus
npm
All versions0.1.24
@vitest/browser
npm
All versions3.2.5
@vitest/browser
npm
All versions5.0.0-beta.4

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 9.8 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Frequently Asked Questions

What is CVE-2026-53633?
Vitest Browser: Exposed Browser Mode API Can Proxy CDP and Overwrite Config Files, Leading to RCE This vulnerability has been assigned a severity rating of CRITICAL (CVSS score: 9.8/10).
How do I check if my project is affected by CVE-2026-53633?
CVE-2026-53633 affects @vitest/browser and vite-plus. Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-53633 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
9.8

Exploitation is straightforward and causes maximum impact. Patch immediately.

Also Known As

GHSA-g8mr-85jm-7xhm

Related CVEs

  • CVE-2026-47428
    CRITICAL

    Vitest browser mode serves unsanitized otelCarrier query parameter as inline script

  • CVE-2026-73653
    CRITICAL

    @vitest/browser: Browser Mode provider commands bypass the file-access permission gate

  • CVE-2026-107722
    CRITICAL

    fast-jwt: Incomplete patch of CVE-2026-34950: Non-whitespace key-prefix re-enables RSA→HS256 algorithm confusion

  • CVE-2026-108261
    CRITICAL

    TinaCMS admin preview iframe loads an attacker-controlled origin from the URL fragment

  • CVE-2026-41211
    HIGH

    Path traversal in vite-plus/binding downloadPackageManager() writes outside VP_HOME

  • CVE-2026-53632
    MEDIUM

    launch-editor: NTLMv2 hash disclosure via UNC path handling on Windows

Check if you're affected

Scan your dependencies to see if this vulnerability affects your projects.

Scan Your Dependencies