CVE-2025-31125: Vite Vite Has A `server.fs.deny` Bypassed Vulnerability

MODERATE
Advisory Identifier: GHSA-4r4m-qw57-chr8
CVSS 5.3
CWE-284 CWE-200
Published
Advisory Summary

CVE-2025-31125 is a MODERATE (CVSS 5.3) vite has a `server.fs.deny` bypassed vulnerability (CWE-284: Improper Access Control) affecting Vite libraries in the npm ecosystem. The issue involves vite has a `server.fs.deny` bypassed for `inline` and `raw` with `?import` query. Remediation is available by upgrading affected packages to version 6.1.3, 6.2.4, 6.0.13, 5.4.16, 4.5.11.

CVE-2025-31125 at a Glance

CVE Identifier CVE-2025-31125
GHSA Identifier GHSA-4r4m-qw57-chr8
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-284: Improper Access Control
Affected Product Vite
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 5.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2025-31125

To remediate this vulnerability, upgrade all affected Vite dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

vite fixed: 6.1.3
npm install vite@6.1.3
vite fixed: 6.2.4
npm install vite@6.2.4
vite fixed: 6.0.13
npm install vite@6.0.13
vite fixed: 5.4.16
npm install vite@5.4.16
vite fixed: 4.5.11
npm install vite@4.5.11
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls vite

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2025-31125, inspect your project dependencies using npm:

npm ls vite

Analyze the terminal output to locate any version of Vite in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 6.1.3), your application is affected.

Note: The npm ls vite command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-284: Improper Access Control, where the product does not restrict or incorrectly restricts access to a resource from an unauthorized actor. In Vite, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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](https://vitejs.dev/config/server-options.html#server-host)) 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`

CVE-2025-31125 Affected Vite Versions

5 component(s)
Fixed Versions:
6.1.36.2.46.0.135.4.164.5.11
Product / Package Ecosystem Affected Versions Fixed Version
vite
npm
≥ 6.1.0
< 6.1.3
6.1.3
vite
npm
≥ 6.2.0
< 6.2.4
6.2.4
vite
npm
≥ 6.0.0
< 6.0.13
6.0.13
vite
npm
≥ 5.0.0
< 5.4.16
5.4.16
vite
npm
< 4.5.11
4.5.11

References

Frequently Asked Questions

What is CVE-2025-31125?
CVE-2025-31125 is a security vulnerability in Vite involving Vite has a `server.fs.deny` bypassed for `inline` and `raw` with `?import` query under CWE-284: Improper Access Control.
Which Vite versions are affected?
Affected versions include releases prior to 6.1.3, 6.2.4, 6.0.13, 5.4.16, 4.5.11 across affected packages: vite.
What version fixes CVE-2025-31125?
Upgrading to 6.1.3, 6.2.4, 6.0.13, 5.4.16, 4.5.11 (or the latest patched release for your respective branch) resolves the vulnerability.
Is vite affected?
Yes, vite is affected in releases prior to 6.1.3, 6.2.4, 6.0.13, 5.4.16, 4.5.11. Upgrade your dependency to 6.1.3, 6.2.4, 6.0.13, 5.4.16, 4.5.11 or later.
What is the CVSS score of CVE-2025-31125?
CVE-2025-31125 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2025-31125?
CVE-2025-31125 is classified under CWE-284: Improper Access Control (The product does not restrict or incorrectly restricts access to a resource from an unauthorized actor.).
How can I check npm dependencies for CVE-2025-31125?
Run the dependency tree command: 'npm ls vite'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-4r4m-qw57-chr8",
  "modified" : "2026-01-22T21:47:40Z",
  "published" : "2025-03-31T17:31:54Z",
  "aliases" : [ "CVE-2025-31125" ],
  "summary" : "Vite has a `server.fs.deny` bypassed for `inline` and `raw` with `?import` query",
  "details" : "### Summary\n\nThe contents of arbitrary files can be returned to the browser.\n\n### Impact\nOnly apps explicitly exposing the Vite dev server to the network (using `--host` or [`server.host` config option](https://vitejs.dev/config/server-options.html#server-host)) are affected.\n\n### Details\n\n- base64 encoded content of non-allowed files is exposed using `?inline&import` (originally reported as `?import&?inline=1.wasm?init`)\n- content of non-allowed files is exposed using `?raw?import`\n\n`/@fs/` isn't needed to reproduce the issue for files inside the project root.\n\n### PoC\n\nOriginal report (check details above for simplified cases):\n\nThe ?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\n```\n$ npm create vite@latest\n$ cd vite-project/\n$ npm install\n$ npm run dev\n```\n\nExample full URL `http://localhost:5173/@fs/C:/windows/win.ini?import&?inline=1.wasm?init`",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "vite"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.2.0"
      }, {
        "fixed" : "6.2.4"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "vite"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.1.0"
      }, {
        "fixed" : "6.1.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "vite"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.0.0"
      }, {
        "fixed" : "6.0.13"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "vite"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.0.0"
      }, {
        "fixed" : "5.4.16"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "vite"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.5.11"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/vitejs/vite/security/advisories/GHSA-4r4m-qw57-chr8"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-31125"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vitejs/vite/commit/59673137c45ac2bcfad1170d954347c1a17ab949"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/vitejs/vite"
  }, {
    "type" : "WEB",
    "url" : "https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2025-31125"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-200", "CWE-284" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-03-31T17:31:54Z",
    "nvd_published_at" : "2025-03-31T17:15:43Z"
  }
}