Vitest: Exposed Browser Mode API Can Proxy CDP and Overwrite Config Files, Leading to RCE
vitest-dev vitest
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| @vitest/browser npm |
|
|
| vite-plus npm |
vitest-dev vitest
| Product | Affected | Fixed in |
|---|---|---|
| @vitest/browser npm |
|
|
| vite-plus npm |
< 0.1.24
|
Vitest is a testing framework powered by Vite. From 3.0.0 until 3.2.5, 4.1.8, and 5.0.0-beta.4, Vitest Browser Mode exposed a cdp() API that forwarded raw Chrome DevTools Protocol methods without being gated by allowWrite or allowExec, allowing a remote client with exposed browser API metadata to use CDP Page.setDownloadBehavior and Runtime.evaluate to overwrite vite.config.ts and execute attacker-controlled Node.js code. This issue is fixed in versions 3.2.5, 4.1.8, and 5.0.0-beta.
From the CVE record · GitHub_M
Vitest Browser Mode exposed a cdp() API that forwarded Chrome DevTools Protocol methods without allowWrite or allowExec checks. A remote client with access to exposed browser API metadata could overwrite vite.config.ts and execute attacker-controlled Node.js code.
Teams using npm @vitest/browser versions 3.0.0 through before 3.2.5, 4.0.0 through before 4.1.8, or 5.0.0-beta.0 through before 5.0.0-beta.4, or npm vite-plus versions before 0.1.24, should check their dependencies.