Skip to content

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

Moderate severity GitHub Reviewed Published Mar 31, 2025 in vitejs/vite • Updated Mar 31, 2025

Package

npm vite (npm)

Affected versions

>= 6.2.0, < 6.2.4
>= 6.1.0, < 6.1.3
>= 6.0.0, < 6.0.13
>= 5.0.0, < 5.4.16
< 4.5.11

Patched versions

6.2.4
6.1.3
6.0.13
5.4.16
4.5.11

Description

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

References

@patak-dev patak-dev published to vitejs/vite Mar 31, 2025
Published by the National Vulnerability Database Mar 31, 2025
Published to the GitHub Advisory Database Mar 31, 2025
Reviewed Mar 31, 2025
Last updated Mar 31, 2025

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
High
Privileges required
None
User interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N

EPSS score

Exploit Prediction Scoring System (EPSS)

This score estimates the probability of this vulnerability being exploited within the next 30 days. Data provided by FIRST.
(7th percentile)

CVE ID

CVE-2025-31125

GHSA ID

GHSA-4r4m-qw57-chr8

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.