CVE-2026-53633: Vitest Browser Remote Code Execution Vulnerability

CRITICAL
Advisory Identifier: GHSA-g8mr-85jm-7xhm
CVSS 9.8
CWE-749 CWE-862
Published
Advisory Summary

CVE-2026-53633 is a CRITICAL (CVSS 9.8) remote code execution vulnerability (CWE-749: Exposed Dangerous Method or Function) affecting Vitest Browser libraries in the npm ecosystem. The issue involves exposed browser mode api can proxy cdp and overwrite config files, leading to rce. Remediation is available by upgrading affected packages to version 5.0.0-beta.4, 4.1.8, 3.2.5, 0.1.24.

CVE-2026-53633 at a Glance

CVE Identifier CVE-2026-53633
GHSA Identifier GHSA-g8mr-85jm-7xhm
Severity CRITICAL
CVSS v3.1 Base Score 9.8
CWE Classification CWE-749: Exposed Dangerous Method or Function
Affected Product Vitest Browser
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 9.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-53633

To remediate this vulnerability, upgrade all affected Vitest Browser dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

@vitest/browser fixed: 5.0.0-beta.4
npm install @vitest/browser@5.0.0-beta.4
@vitest/browser fixed: 4.1.8
npm install @vitest/browser@4.1.8
@vitest/browser fixed: 3.2.5
npm install @vitest/browser@3.2.5
vite-plus fixed: 0.1.24
npm install vite-plus@0.1.24
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls @vitest/browser

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-53633, inspect your project dependencies using npm:

npm ls @vitest/browser

Analyze the terminal output to locate any version of Vitest Browser in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.0.0-beta.4), your application is affected.

Note: The npm ls @vitest/browser command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-749: Exposed Dangerous Method or Function, where the product provides an applications programming interface (api) or similar interface for interaction with external actors, but the interface includes a dangerous method or function that is not properly restricted. In Vitest Browser, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## 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.

CVE-2026-53633 Affected Vitest Browser Versions

4 component(s)
Fixed Versions:
5.0.0-beta.44.1.83.2.50.1.24
Product / Package Ecosystem Affected Versions Fixed Version
@vitest/browser
npm
≥ 5.0.0-beta.0
< 5.0.0-beta.4
5.0.0-beta.4
@vitest/browser
npm
≥ 4.0.0
< 4.1.8
4.1.8
@vitest/browser
npm
≥ 3.0.0
< 3.2.5
3.2.5
vite-plus
npm
< 0.1.24
0.1.24

References

Frequently Asked Questions

What is CVE-2026-53633?
CVE-2026-53633 is a security vulnerability in Vitest Browser involving Exposed Browser Mode API Can Proxy CDP and Overwrite Config Files, Leading to RCE under CWE-749: Exposed Dangerous Method or Function.
Which Vitest Browser versions are affected?
Affected versions include releases prior to 5.0.0-beta.4, 4.1.8, 3.2.5, 0.1.24 across affected packages: @vitest/browser, vite-plus.
What version fixes CVE-2026-53633?
Upgrading to 5.0.0-beta.4, 4.1.8, 3.2.5, 0.1.24 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @vitest/browser affected?
Yes, @vitest/browser is affected in releases prior to 5.0.0-beta.4, 4.1.8, 3.2.5. Upgrade your dependency to 5.0.0-beta.4, 4.1.8, 3.2.5 or later.
Is vite-plus affected?
Yes, vite-plus is affected in releases prior to 0.1.24. Upgrade your dependency to 0.1.24 or later.
What is the CVSS score of CVE-2026-53633?
CVE-2026-53633 has a CVSS v3.1 base score of 9.8 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2026-53633?
CVE-2026-53633 is classified under CWE-749: Exposed Dangerous Method or Function (The product provides an Applications Programming Interface (API) or similar interface for interaction with external actors, but the interface includes a dangerous method or function that is not properly restricted.).
How can I check npm dependencies for CVE-2026-53633?
Run the dependency tree command: 'npm ls @vitest/browser'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-g8mr-85jm-7xhm",
  "modified" : "2026-08-13T18:19:32Z",
  "published" : "2026-06-15T20:05:15Z",
  "aliases" : [ "CVE-2026-53633" ],
  "summary" : "Vitest Browser: Exposed Browser Mode API Can Proxy CDP and Overwrite Config Files, Leading to RCE",
  "details" : "## Summary\n\nVitest 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`.\n\nAs 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.\n\nWhen 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.\n\n## Impact\n\nThis 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`.\n\nIn 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.\n\nThe 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.\n\n## Reproduction\n\nFor a concrete reproduction, start Browser Mode in watch mode using the official Lit example:\n\n```sh\npnpm dlx tiged vitest-dev/vitest/examples/lit vitest-poc\ncd vitest-poc\npnpm install\n```\n\nConfigure the Browser Mode API to listen on all interfaces while explicitly disabling write and exec operations:\n\n```ts\nimport { playwright } from '@vitest/browser-playwright'\nimport { defineConfig } from 'vite'\n\nexport default defineConfig({\n  test: {\n    browser: {\n      enabled: true,\n      provider: playwright(),\n      instances: [\n        { browser: 'chromium' },\n      ],\n      api: {\n        host: '0.0.0.0',\n        allowWrite: false,\n        allowExec: false,\n      },\n    },\n  },\n})\n```\n\nThen start the test server:\n\n```sh\npnpm test\n```\n\nVitest serves the browser runner HTML and WebSocket API at `http://localhost:63315`.\n\nWhile the browser session is active:\n\n1. Fetch the generated browser runner page:\n\n   ```text\n   http://localhost:63315/__vitest_test__/\n   ```\n\n2. Extract the embedded browser API token, active session id, project name, and project root:\n\n   - `window.VITEST_API_TOKEN`\n   - `__vitest_browser_runner__.sessionId`\n   - `__vitest_browser_runner__.config.name`\n   - `__vitest_browser_runner__.config.root`\n\n3. Connect to the browser API WebSocket as a tester client:\n\n   ```text\n   /__vitest_browser_api__?type=tester&rpcId=<fresh-id>&sessionId=<session-id>&projectName=<project-name>&method=none&token=<token>\n   ```\n\n4. Call the `sendCdpEvent` RPC method with:\n\n   ```text\n   Page.setDownloadBehavior({\n     behavior: \"allow\",\n     downloadPath: __vitest_browser_runner__.config.root\n   })\n   ```\n\n5. 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\">`.\n\n6. Observed result:\n\n   - `vite.config.ts` is overwritten with attacker-controlled content.\n   - Vitest reloads the changed config.\n   - The injected Node.js payload runs on the host.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@vitest/browser"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.0.0-beta.0"
      }, {
        "fixed" : "5.0.0-beta.4"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 5.0.0-beta.3"
    }
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@vitest/browser"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.0.0"
      }, {
        "fixed" : "4.1.8"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 4.1.7"
    }
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@vitest/browser"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "3.2.5"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 3.2.4"
    }
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "vite-plus"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.1.24"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.1.23"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/vitest-dev/vitest/security/advisories/GHSA-g8mr-85jm-7xhm"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-53633"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vitest-dev/vitest/pull/10444"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vitest-dev/vitest/pull/10450"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vitest-dev/vitest/pull/10456"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vitest-dev/vitest/commit/385a1aefd4c2bfa5e7d58bf7c6834c929969f2c7"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vitest-dev/vitest/commit/63e3b2eee4d58da56786a6333f517b9b492528c7"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vitest-dev/vitest/commit/e4067b3b150005fd42cf75f994300119245806b9"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/vitest-dev/vitest"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vitest-dev/vitest/releases/tag/v3.2.5"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vitest-dev/vitest/releases/tag/v4.1.8"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vitest-dev/vitest/releases/tag/v5.0.0-beta.4"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-749", "CWE-862" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-06-15T20:05:15Z",
    "nvd_published_at" : "2026-07-14T20:17:42Z"
  }
}