Arbitrary File Read Vulnerability in Vite (CVE-2025-31125)
About the Author Hi, I'm Sharon, a product manager at Chaitin Tech. We build SafeLine, an open-source Web Application Firewall that protects against real-world web threats like injections, web shells, and bot attacks. Our emergency response team also tracks non-HTTP vulnerabilities that impact frontend and dev environments like this one. Vite is a modern frontend build tool designed to provide a fast development server and optimized build process, widely used in JavaScript and TypeScript web development. In March 2025, security researchers at Chaitin Tech discovered a high-risk arbitrary file read vulnerability in Vite. The vulnerability was immediately reported to regulatory authorities. The Vite team has since released patches to fix this issue (CVE-2025-31125). The vulnerability allows attackers to bypass Vite’s file access restrictions and read arbitrary files on the server by crafting special URLs. While it requires specific server configurations to exploit, its impact could be widespread due to Vite’s popularity among frontend frameworks. Affected users are strongly urged to patch as soon as possible. Vulnerability Description Root Cause The vulnerability is caused by flaws in Vite’s regular expression and URL parameter handling when processing URLs with specific query strings. This leads to a bypass of file access control checks. Attackers can craft malicious request paths to access files outside the allowed scope. Exploitation Requirements The Vite development server must be exposed to the network using the --host or server.host configuration (default is localhost-only). Impact Arbitrary File Read: Attackers can read sensitive files on the server (e.g., config files, key files), which may lead to credential leaks or further security threats. Risk Overview Category Details Priority High Vulnerability Type Logical flaw Severity High Trigger Remote over network Authentication Not required System Config Non-default (Vite server exposed publicly) User Interaction Not required Exploit Availability Public PoC/EXP available Fix Complexity Low (official patches available) Affected Versions Vite 6.2.0 – 6.2.3 Vite 6.1.0 – 6.1.2 Vite 6.0.0 – 6.0.12 Vite 5.0.0 – 5.4.15 Vite

About the Author
Hi, I'm Sharon, a product manager at Chaitin Tech. We build SafeLine, an open-source Web Application Firewall that protects against real-world web threats like injections, web shells, and bot attacks. Our emergency response team also tracks non-HTTP vulnerabilities that impact frontend and dev environments like this one.
Vite is a modern frontend build tool designed to provide a fast development server and optimized build process, widely used in JavaScript and TypeScript web development.
In March 2025, security researchers at Chaitin Tech discovered a high-risk arbitrary file read vulnerability in Vite. The vulnerability was immediately reported to regulatory authorities. The Vite team has since released patches to fix this issue (CVE-2025-31125). The vulnerability allows attackers to bypass Vite’s file access restrictions and read arbitrary files on the server by crafting special URLs. While it requires specific server configurations to exploit, its impact could be widespread due to Vite’s popularity among frontend frameworks. Affected users are strongly urged to patch as soon as possible.
Vulnerability Description
Root Cause
The vulnerability is caused by flaws in Vite’s regular expression and URL parameter handling when processing URLs with specific query strings. This leads to a bypass of file access control checks. Attackers can craft malicious request paths to access files outside the allowed scope.
Exploitation Requirements
- The Vite development server must be exposed to the network using the
--host
orserver.host
configuration (default is localhost-only).
Impact
- Arbitrary File Read: Attackers can read sensitive files on the server (e.g., config files, key files), which may lead to credential leaks or further security threats.
Risk Overview
Category | Details |
---|---|
Priority | High |
Vulnerability Type | Logical flaw |
Severity | High |
Trigger | Remote over network |
Authentication | Not required |
System Config | Non-default (Vite server exposed publicly) |
User Interaction | Not required |
Exploit Availability | Public PoC/EXP available |
Fix Complexity | Low (official patches available) |
Affected Versions
- Vite 6.2.0 – 6.2.3
- Vite 6.1.0 – 6.1.2
- Vite 6.0.0 – 6.0.12
- Vite 5.0.0 – 5.4.15
- Vite <= 4.5.10
Mitigation & Fixes
Temporary Workarounds
If you cannot upgrade immediately:
-
Restrict Network Access: Set
--host
orserver.host
tolocalhost
to prevent external exposure. - Enforce File Permissions: Ensure sensitive files cannot be read by the Vite process (via OS-level permission controls).
Official Patch
The Vite team has released patched versions:
- 6.2.4, 6.1.3, 6.0.13, 5.4.16, 4.5.11
Update via npm update vite
or upgrade manually.
Reproduction
Product Support
Product | Detection Capability |
---|---|
Yuntu | Supports fingerprinting and PoC detection |
Dongjian | Will support detection in upcoming 4.2 release |
SafeLine | Custom rules released to detect this vulnerability |
Quanxi | Rule upgrade package released |
Timeline
- March 31, 2025 – Reported to regulatory authority by Chaitin Tech
- March 31, 2025 – Vite official patch released
- April 1, 2025 – Advisory published by Chaitin Security Response Center