ZeroHour

CVE-2025-31486

large

Arbitrary File Read via server.fs.deny Bypass in Vite Dev Server

CVSS 3.1
5.3 medium
EPSS
40%p99
Published
()
Modified
AI analysis

Vite, a widely used JavaScript frontend tooling framework, contains a bypass of the server.fs.deny restriction that lets the dev server return the contents of arbitrary files to the browser. An attacker triggers it by requesting a target path with a ?.svg suffix combined with ?.wasm?init or a sec-fetch-dest: script header, which succeeds only when the file is smaller than build.assetsInlineLimit (default 4kB) and when running Vite 6.0+. This yields disclosure of small sensitive files (e.g., config or environment files under 4kB) from the machine running the dev server. Only applications that explicitly expose the Vite dev server to the network via --host or the server.host config option are affected; fixed versions are 4.5.12, 5.4.17, 6.0.14, 6.1.4, and 6.2.5. No public proof-of-concept or CISA KEV listing exists yet, but the EPSS model assigns a 40.2% probability of exploitation within 30 days (99th percentile), so defenders should prioritize patching.

What to do: Upgrade Vite to 4.5.12, 5.4.17, 6.0.14, 6.1.4, or 6.2.5, matching your current major version. As an interim mitigation, avoid exposing the dev server via --host or server.host, or restrict network access to it with firewall rules. Inventory your environment for internet-exposed Vite dev servers (default port 5173) and review server.fs.deny configurations.

Affected
Vite (open-source project) ViteAll versions prior to 4.5.12 (4.x), 5.4.17 (5.x), 6.0.14 (6.0.x), 6.1.4 (6.1.x), and 6.2.5 (6.2.x); the described bypass applies to Vite 6.0+ dev servers expose
Estimated exposure
large≈10,000–30,000 internet-exposed Vite dev servers (order of tens of thousands per public scans of the default dev server port 5173), out of millions of… — Internet-wide scans of the Vite dev server's default port (5173) show on the order of tens of thousands of exposed hosts, and only the subset running Vite 6.0+ with --host/server.host enabled is exploitable, making this a clear estimate.

Order-of-magnitude estimate by the model from install counts, market share and public scan data it knows; verify before quoting.

Description

Vite is a frontend tooling framework for javascript. The contents of arbitrary files can be returned to the browser. By adding ?.svg with ?.wasm?init or with sec-fetch-dest: script header, the server.fs.deny restriction was able to bypass. This bypass is only possible if the file is smaller than build.assetsInlineLimit (default: 4kB) and when using Vite 6.0+. Only apps explicitly exposing the Vite dev server to the network (using --host or server.host config option) are affected. This vulnerability is fixed in 4.5.12, 5.4.17, 6.0.14, 6.1.4, and 6.2.5.

Weakness
CWE-200, CWE-284
Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N

In the news

No ingested article mentions this CVE yet.