Advisory

GHSA-4r4m-qw57-chr8

Also known as: CVE-2025-31125

Summary

Vite has a server.fs.deny bypassed for inline and raw with ?import query

Details

Summary

The contents of arbitrary files can be returned to the browser.

Impact
Only apps explicitly exposing the Vite dev server to the network (using --host or `server.host` config option) are affected.

Details

  • base64 encoded content of non-allowed files is exposed using ?inline&import (originally reported as ?import&?inline=1.wasm?init)
  • content of non-allowed files is exposed using ?raw?import

/@fs/ isn't needed to reproduce the issue for files inside the project root.

PoC

Original report (check details above for simplified cases):

The ?import&?inline=1.wasm?init ending allows attackers to read arbitrary files and returns the file content if it exists. Base64 decoding needs to be performed twice

$ npm create vite@latest
$ cd vite-project/
$ npm install
$ npm run dev

Example full URL http://localhost:5173/@fs/C:/windows/win.ini?import&?inline=1.wasm?init

Severity

Medium Basis: The source's own band: MODERATE

Dates

Published
2025-03-31 17:31 UTC
Modified
2026-09-10 03:50 UTC

Affected packages and fixes

vite

npm · All systems

Affected

  • introduced 6.2.0, fixed 6.2.4 (semver)

Fixed versions

6.2.4

Fix

vite

npm · All systems

Affected

  • introduced 6.1.0, fixed 6.1.3 (semver)

Fixed versions

6.1.3

Fix

vite

npm · All systems

Affected

  • introduced 6.0.0, fixed 6.0.13 (semver)

Fixed versions

6.0.13

Fix

vite

npm · All systems

Affected

  • introduced 5.0.0, fixed 5.4.16 (semver)

Fixed versions

5.4.16

Fix

vite

npm · All systems

Affected

  • introduced 0, fixed 4.5.11 (semver)

Fixed versions

4.5.11

Fix

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences