CVE-2023-34092: Vite Server Options (server.fs.deny) can be bypassed using double forward-slash (//)
The issue involves a security vulnerability in Vite where the server options can be bypassed using a double forward slash (//). This vulnerability poses a potential security risk as it can allow unauthorized access to sensitive directories and files.
Steps to Fix. Update Vite: Ensure that you are using the latest version of Vite. Security issues like this are often fixed in newer releases.\n2. Secure the server configuration: In your vite.config.js file, review and update the server configuration options to restrict access to unauthorized requests or directories.
Impact Only users explicitly exposing the Vite dev server to the network (using --host or the server.host config option) are affected and only files in the immediate Vite project root folder could be exposed.\n\n### Patches\nFixed in vite@4.3.9, vite@4.2.3, vite@4.1.5, vite@4.0.5 and in the latest minors of the previous two majors, vite@3.2.7 and vite@2.9.16.
### Details Vite serves the application with under the root-path of the project while running on the dev mode. By default, Vite uses the server option fs.deny to protect sensitive files. But using a simple double forward-slash, we can bypass this restriction. \n\n### PoC\n1. Create a new latest project of Vite using any package manager. (here I'm using react and vue templates and pnpm for testing)\n2. Serve the application on dev mode using pnpm run dev.\n3. Directly access the file via url using double forward-slash (//) (e.g: //.env, //.env.local)\n4. The server option fs.deny was successfully bypassed.
Proof Images: !proof-1\n!proof-2
Other sources
Vite provides frontend tooling. Prior to versions 2.9.16, 3.2.7, 4.0.5, 4.1.5, 4.2.3, and 4.3.9, Vite Server Options (server.fs.deny) can be bypassed using double forward-slash (//) allows any unauthenticated user to read file from the Vite root-path of the application including the default fs.deny settings (['.env', '.env.', '.{crt,pem}']). Only users explicitly exposing the Vite dev server to the network (using --host or server.host config option) are affected, and only files in the immediate Vite project root folder could be exposed. This issue is fixed in vite@4.3.9, vite@4.2.3, vite@4.1.5, vite@4.0.5, vite@3.2.7, and vite@2.9.16.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
npm/viteto a version that resolves this vulnerability.Fixed in 4.3.9 - Upgrade
Upgrade
npm/viteto a version that resolves this vulnerability.Fixed in 4.2.3 - Upgrade
Upgrade
npm/viteto a version that resolves this vulnerability.Fixed in 4.1.5 - Upgrade
Upgrade
npm/viteto a version that resolves this vulnerability.Fixed in 4.0.5 - Upgrade
Upgrade
npm/viteto a version that resolves this vulnerability.Fixed in 3.2.7 - Upgrade
Upgrade
npm/viteto a version that resolves this vulnerability.Fixed in 2.9.16 - Upgrade
Upgrade
viteto a version that resolves this vulnerability.Fixed in 4.3.9 - Upgrade
Upgrade
viteto a version that resolves this vulnerability.Fixed in 4.2.3 - Upgrade
Upgrade
viteto a version that resolves this vulnerability.Fixed in 4.1.5 - Upgrade
Upgrade
viteto a version that resolves this vulnerability.Fixed in 4.0.5 - Upgrade
Upgrade
viteto a version that resolves this vulnerability.Fixed in 3.2.7 - Upgrade
Upgrade
viteto a version that resolves this vulnerability.Fixed in 2.9.16 - Configuration
Only users explicitly exposing the Vite dev server to the network (via `--host` or `server.host`) are affected. Ensure `server.host`/`--host` is not set to a public/untrusted address; restrict dev-server exposure to trusted networks/localhost.
Vite dev server server.host (or --host) = Only bind to localhost/internal network; do not expose to untrusted networks
Event History
Frequently Asked Questions
What is CVE-2023-34092?
CVE-2023-34092 is a security vulnerability in Vite that allows unauthorized access to sensitive directories and files.
How severe is CVE-2023-34092?
CVE-2023-34092 has a severity rating of 7.5 (High).
How can I fix CVE-2023-34092?
To fix CVE-2023-34092, update Vite to version 4.3.9 or higher.
Is Vite version 4.3.9 affected by CVE-2023-34092?
No, Vite version 4.3.9 is not affected by CVE-2023-34092.
Where can I find more information about CVE-2023-34092?
You can find more information about CVE-2023-34092 on the GitHub page: [link](https://github.com/vitejs/vite/security/advisories/GHSA-353f-5xf4-qw67)