Skip to content

GHSA-4r4m-qw57-chr8 CVE-2025-31125

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

High Known exploited npm
Severity
5.3 / 10
High · CVSS 3.1
Exploit chance (EPSS)
74.94%
Chance of exploitation in the next 30 days. Higher than 99.51% of scored vulnerabilities.
Known exploited
Yes
In CISA's catalog since Jan 22, 2026
Weakness
CWE-200 Exposure of Sensitive Information to an Unauthorized Actor
CWE-284 Improper Access Control
Fix
6.2.4
Upgrade vite to this version or later
Exploited in the wild. Vite Vitejs Improper Access Control Vulnerability (Vite Vitejs). Required action: Apply mitigations per vendor instructions, follow applicable BOD 22-01 guidance for cloud services, or discontinue use of the product if mitigations are unavailable. Due for U.S. federal agencies by Feb 12, 2026.

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

Affected versions

npm

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

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

vite npm → 6.2.4

npm
npm install vite@6.2.4
yarn
yarn add vite@6.2.4
pnpm
pnpm add vite@6.2.4

Severity breakdown

CVSS 3.1 5.3

CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N

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

Weakness

CWE-200: Exposure of Sensitive Information to an Unauthorized Actor

The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.

How to prevent it
  • Architecture and Design: Compartmentalize the system to have "safe" areas where trust boundaries can be unambiguously drawn. Do not allow sensitive data to go outside of the trust boundary and always be careful when interfacing with a compartment outside of the safe area. Ensure that appropriate compartmentalization is built into the system design, and the compartmentalization allows for and reinforces privilege separation functionality. Architects and designers should rely on the principle of least privilege to decide the appropriate time to use privileges and the time to drop privileges.

CWE-284: Improper Access Control

The product does not restrict or incorrectly restricts access to a resource from an unauthorized actor.

How to prevent it
  • Architecture and Design, Operation: Very carefully manage the setting, management, and handling of privileges. Explicitly manage trust zones in the software.
  • Architecture and Design: Compartmentalize the system to have "safe" areas where trust boundaries can be unambiguously drawn. Do not allow sensitive data to go outside of the trust boundary and always be careful when interfacing with a compartment outside of the safe area. Ensure that appropriate compartmentalization is built into the system design, and the compartmentalization allows for and reinforces privilege separation functionality. Architects and designers should rely on the principle of least privilege to decide the appropriate time to use privileges and the time to drop privileges.

References

Timeline

  1. Published
  2. Added to CISA's Known Exploited Vulnerabilities catalog
  3. Remediation due for U.S. federal agencies
  4. Last updated by the source
  5. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-8g5g-mxqh-grgj
Vite: `server.fs.deny` bypassed with queries
Medium Also affects vite
GHSA-vfpm-58rq-9qcg
Vite: First 4 bytes of files outside of `server.fs` setting is exposed by `?vite-wasm-instance`
Medium Also affects vite
GHSA-rq7h-c2jc-7f22
Vite: Files outside `server.fs.allow` could be served when project paths match system paths on non-Windows machine
Medium Also affects vite
GHSA-9jrq-w75r-8gcw
Vite: Cross origin script execution through Vite custom middleware
Low Also affects vite
GHSA-r825-w8mm-5pxw
launch-editor: Editor CLI flag misinterpretation causing arbitrary command execution for some editors
Medium Also affects vite
GHSA-698v-4r3x-3vcv
launch-editor: escapeCmdArgs() omits % escaping on Windows
Medium Also affects vite
GHSA-587h-7wmj-h5pm
launch-editor: `fs.existsSync()` existence check can be bypassed on Windows
High Also affects vite
GHSA-v6wh-96g9-6wx3
launch-editor: NTLMv2 hash disclosure via UNC path handling on Windows
Medium Also affects vite

Credits: Iuhsssss

Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor