CVE-2025-62522: Vite Vite Allows Server.fs.deny Bypass Vulnerability

MODERATE
Advisory Identifier: GHSA-93m4-6634-74q7
CWE-22
Published
Advisory Summary

CVE-2025-62522 is a MODERATE vite allows server.fs.deny bypass vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Vite libraries in the npm ecosystem. The issue involves vite allows server.fs.deny bypass via backslash on windows. Remediation is available by upgrading affected packages to version 7.1.11, 7.0.8, 6.4.1, 5.4.21.

CVE-2025-62522 at a Glance

CVE Identifier CVE-2025-62522
GHSA Identifier GHSA-93m4-6634-74q7
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Vite
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2025-62522

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: 7.1.11
npm install vite@7.1.11
vite fixed: 7.0.8
npm install vite@7.0.8
vite fixed: 6.4.1
npm install vite@6.4.1
vite fixed: 5.4.21
npm install vite@5.4.21
vite fixed: 5.4.21
npm install vite@5.4.21
vite fixed: 5.4.21
npm install vite@5.4.21
vite fixed: 5.4.21
npm install vite@5.4.21
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-62522, 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 7.1.11), 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-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. 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 Files denied by [`server.fs.deny`](https://vitejs.dev/config/server-options.html#server-fs-deny) were sent if the URL ended with `\` when the dev server is running on Windows. ### Impact Only apps that match the following conditions are affected: - explicitly exposes the Vite dev server to the network (using --host or [`server.host` config option](https://vitejs.dev/config/server-options.html#server-host)) - running the dev server on Windows ### Details `server.fs.deny` can contain patterns matching against files (by default it includes `.env`, `.env.*`, `*.{crt,pem}` as such patterns). These patterns were able to bypass by using a back slash(`\`). The root cause is that `fs.readFile('/foo.png/')` loads `/foo.png`. ### PoC ```shell npm create vite@latest cd vite-project/ cat "secret" > .env npm install npm run dev curl --request-target /.env\ http://localhost:5173 ``` <img width="1593" height="616" alt="image" src="https://github.com/user-attachments/assets/36212f4e-1d3c-4686-b16f-16b35ca9e175" />

CVE-2025-62522 Affected Vite Versions

7 component(s)
Fixed Versions:
7.1.117.0.86.4.15.4.21
Product / Package Ecosystem Affected Versions Fixed Version
vite
npm
≥ 7.1.0
< 7.1.11
7.1.11
vite
npm
≥ 7.0.0
< 7.0.8
7.0.8
vite
npm
≥ 6.0.0
< 6.4.1
6.4.1
vite
npm
≥ 2.9.18
< 5.4.21
5.4.21
vite
npm
≥ 3.2.9
< 5.4.21
5.4.21
vite
npm
≥ 4.5.3
< 5.4.21
5.4.21
vite
npm
≥ 5.2.6
< 5.4.21
5.4.21

References

Frequently Asked Questions

What is CVE-2025-62522?
CVE-2025-62522 is a security vulnerability in Vite involving vite allows server.fs.deny bypass via backslash on Windows under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Vite versions are affected?
Affected versions include releases prior to 7.1.11, 7.0.8, 6.4.1, 5.4.21 across affected packages: vite.
What version fixes CVE-2025-62522?
Upgrading to 7.1.11, 7.0.8, 6.4.1, 5.4.21 (or the latest patched release for your respective branch) resolves the vulnerability.
Is vite affected?
Yes, vite is affected in releases prior to 7.1.11, 7.0.8, 6.4.1, 5.4.21. Upgrade your dependency to 7.1.11, 7.0.8, 6.4.1, 5.4.21 or later.
What CWE is associated with CVE-2025-62522?
CVE-2025-62522 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check npm dependencies for CVE-2025-62522?
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-93m4-6634-74q7",
  "modified" : "2025-10-21T14:51:26Z",
  "published" : "2025-10-20T19:54:28Z",
  "aliases" : [ "CVE-2025-62522" ],
  "summary" : "vite allows server.fs.deny bypass via backslash on Windows",
  "details" : "### Summary\nFiles denied by [`server.fs.deny`](https://vitejs.dev/config/server-options.html#server-fs-deny) were sent if the URL ended with `\\` when the dev server is running on Windows.\n\n### Impact\nOnly apps that match the following conditions are affected:\n\n- explicitly exposes the Vite dev server to the network (using --host or [`server.host` config option](https://vitejs.dev/config/server-options.html#server-host))\n- running the dev server on Windows\n\n### Details\n`server.fs.deny` can contain patterns matching against files (by default it includes `.env`, `.env.*`, `*.{crt,pem}` as such patterns). These patterns were able to bypass by using a back slash(`\\`). The root cause is that `fs.readFile('/foo.png/')` loads `/foo.png`.\n\n### PoC\n```shell\nnpm create vite@latest\ncd vite-project/\ncat \"secret\" > .env\nnpm install\nnpm run dev\ncurl --request-target /.env\\ http://localhost:5173\n```\n<img width=\"1593\" height=\"616\" alt=\"image\" src=\"https://github.com/user-attachments/assets/36212f4e-1d3c-4686-b16f-16b35ca9e175\" />",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "vite"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "7.1.0"
      }, {
        "fixed" : "7.1.11"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 7.1.10"
    }
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "vite"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "7.0.0"
      }, {
        "fixed" : "7.0.8"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 7.0.7"
    }
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "vite"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.0.0"
      }, {
        "fixed" : "6.4.1"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 6.4.0"
    }
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "vite"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.9.18"
      }, {
        "fixed" : "5.4.21"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "< 3.0.0"
    }
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "vite"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.2.9"
      }, {
        "fixed" : "5.4.21"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "< 4.0.0"
    }
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "vite"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.5.3"
      }, {
        "fixed" : "5.4.21"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "< 5.0.0"
    }
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "vite"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.2.6"
      }, {
        "fixed" : "5.4.21"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 5.4.20"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/vitejs/vite/security/advisories/GHSA-93m4-6634-74q7"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-62522"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vitejs/vite/commit/f479cc57c425ed41ceb434fecebd63931b1ed4ed"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/vitejs/vite"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-10-20T19:54:28Z",
    "nvd_published_at" : "2025-10-20T20:15:37Z"
  }
}