CVE-2026-84373: Vitest: Path Traversal / Arbitrary File Read via @vitest/mocker Redirect Mock
@vitest/mocker registers a redirect mock’s target path without validating it
against the dev server’s file-serving allowlist. An attacker who can reach the
dev server’s WebSocket can register a redirect mock pointing outside the project
root; when the mocked module is requested, the plugin’s load hook returns
readFile(<attacker path>) as the module source, disclosing local files.
This is exploitable without authentication only through the public
mockerPlugin / standalone interceptorPlugin exports (used by third-party dev
servers), which register the handler on Vite’s unauthenticated HMR socket.
Vitest’s own browser mode registers mocks over a token-authenticated RPC and
is not remotely reachable by default (see Scope).
References
- github.com/advisories/GHSA-82fw-gwwq-j7x9
- github.com/vitest-dev/vitest/commit/51edf2b072902aec6d30c90ebaafd8f121c6f9d8
- github.com/vitest-dev/vitest/commit/8ff9b9a9efca7c6cfd5243569440de8d7a33aec4
- github.com/vitest-dev/vitest/commit/fe5a11d3ceac5ec10d6d7d21a46d4caca132c48f
- github.com/vitest-dev/vitest/pull/10972
- github.com/vitest-dev/vitest/pull/10974
- github.com/vitest-dev/vitest/releases/tag/v4.1.11
- github.com/vitest-dev/vitest/releases/tag/v5.0.0-rc.2
- github.com/vitest-dev/vitest/security/advisories/GHSA-82fw-gwwq-j7x9
- nvd.nist.gov/vuln/detail/CVE-2026-84373
Code Behaviors & Features
Detect and mitigate CVE-2026-84373 with GitLab Dependency Scanning
Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →