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. This document outlines the steps to address and mitigate this issue. Adding Extra References : ## 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.\n\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. For example:```javascript\n // vite.config.js\n export default { server: {\n fs: {\n deny: ['private-directory'] // Restrict access to specific directories
Impact
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.
Patches
Fixed 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, vite@2.9.16
Details
Vite serve the application with under the root-path of the project while running on the dev mode. By default, vite using server options fs.deny to protected the sensitive information of the file. But, with simply double forward-slash, we can bypass this fs restriction.
PoC
Create a new latest project of vite using any package manager. (here I'm using react and vue templates for tested and pnpm)
Serve the application on dev mode using pnpm run dev.
Directly access the file from url using double forward-slash (//) (e.g: //.env, //.env.local)
Server Options fs.deny restrict successfully bypassed.
Proof Images:
Release Notes
vitejs/vite (vite)
### [`v4.0.5`](https://togithub.com/vitejs/vite/releases/tag/v4.0.5)
[Compare Source](https://togithub.com/vitejs/vite/compare/v4.0.4...v4.0.5)
Please refer to [CHANGELOG.md](https://togithub.com/vitejs/vite/blob/v4.0.5/packages/vite/CHANGELOG.md) for details.
### [`v4.0.4`](https://togithub.com/vitejs/vite/blob/HEAD/packages/vite/CHANGELOG.md#small404-2023-01-03-small)
[Compare Source](https://togithub.com/vitejs/vite/compare/v4.0.3...v4.0.4)
- fix: importmap should insert before module preload link ([#11492](https://togithub.com/vitejs/vite/issues/11492)) ([25c64d7](https://togithub.com/vitejs/vite/commit/25c64d7)), closes [#11492](https://togithub.com/vitejs/vite/issues/11492)
- fix: server.host with ipv6 missed \[] (fix [#11466](https://togithub.com/vitejs/vite/issues/11466)) ([#11509](https://togithub.com/vitejs/vite/issues/11509)) ([2c38bae](https://togithub.com/vitejs/vite/commit/2c38bae)), closes [#11466](https://togithub.com/vitejs/vite/issues/11466) [#11509](https://togithub.com/vitejs/vite/issues/11509)
- fix: stop considering parent URLs as public file ([#11145](https://togithub.com/vitejs/vite/issues/11145)) ([568a014](https://togithub.com/vitejs/vite/commit/568a014)), closes [#11145](https://togithub.com/vitejs/vite/issues/11145)
- fix(build): invalidate chunk hash when css changed ([#11475](https://togithub.com/vitejs/vite/issues/11475)) ([7a97a04](https://togithub.com/vitejs/vite/commit/7a97a04)), closes [#11475](https://togithub.com/vitejs/vite/issues/11475)
- fix(cli): ctrl+C no longer kills processes ([#11434](https://togithub.com/vitejs/vite/issues/11434)) ([#11518](https://togithub.com/vitejs/vite/issues/11518)) ([718fc1d](https://togithub.com/vitejs/vite/commit/718fc1d)), closes [#11434](https://togithub.com/vitejs/vite/issues/11434) [#11518](https://togithub.com/vitejs/vite/issues/11518)
- fix(cli): revert ctrl+C no longer kills processes ([#11434](https://togithub.com/vitejs/vite/issues/11434)) ([#11518](https://togithub.com/vitejs/vite/issues/11518)) ([#11562](https://togithub.com/vitejs/vite/issues/11562)) ([3748acb](https://togithub.com/vitejs/vite/commit/3748acb)), closes [#11434](https://togithub.com/vitejs/vite/issues/11434) [#11518](https://togithub.com/vitejs/vite/issues/11518) [#11562](https://togithub.com/vitejs/vite/issues/11562)
- fix(optimizer): check .vite/deps directory existence before removing ([#11499](https://togithub.com/vitejs/vite/issues/11499)) ([1b043f9](https://togithub.com/vitejs/vite/commit/1b043f9)), closes [#11499](https://togithub.com/vitejs/vite/issues/11499)
- fix(ssr): emit js sourcemaps for ssr builds ([#11343](https://togithub.com/vitejs/vite/issues/11343)) ([f12a1ab](https://togithub.com/vitejs/vite/commit/f12a1ab)), closes [#11343](https://togithub.com/vitejs/vite/issues/11343)
- chore: update license ([#11476](https://togithub.com/vitejs/vite/issues/11476)) ([3d346c0](https://togithub.com/vitejs/vite/commit/3d346c0)), closes [#11476](https://togithub.com/vitejs/vite/issues/11476)
- chore(deps): update dependency [@rollup/plugin-json](https://togithub.com/rollup/plugin-json) to v6 ([#11553](https://togithub.com/vitejs/vite/issues/11553)) ([3647d07](https://togithub.com/vitejs/vite/commit/3647d07)), closes [#11553](https://togithub.com/vitejs/vite/issues/11553)
Configuration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
[ ] If you want to rebase/retry this PR, check this box
This PR has been generated by Mend Renovate. View repository job log here.
This PR contains the following updates:
4.0.3
->4.0.5
GitHub Vulnerability Alerts
CVE-2023-34092
Summary
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. This document outlines the steps to address and mitigate this issue. Adding Extra References : ## 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.\n\n2. Secure the Server Configuration:In yourvite.config.js
file, review and update the server configuration options to restrict access to unauthorized requests or directories. For example:```javascript\n // vite.config.js\n export default { server: {\n fs: {\n deny: ['private-directory'] // Restrict access to specific directoriesImpact
Only users explicitly exposing the Vite dev server to the network (using
--host
orserver.host
config option) are affected, and only files in the immediate Vite project root folder could be exposed.Patches
Fixed 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, vite@2.9.16
Details
Vite serve the application with under the root-path of the project while running on the dev mode. By default, vite using server options fs.deny to protected the sensitive information of the file. But, with simply double forward-slash, we can bypass this fs restriction.
PoC
//
) (e.g://.env
,//.env.local
)fs.deny
restrict successfully bypassed.Proof Images:
![proof-2](https://user-images.githubusercontent.com/30733517/241105349-ab9561e7-8aff-4f29-97f9-b784e673c122.png)
Release Notes
vitejs/vite (vite)
### [`v4.0.5`](https://togithub.com/vitejs/vite/releases/tag/v4.0.5) [Compare Source](https://togithub.com/vitejs/vite/compare/v4.0.4...v4.0.5) Please refer to [CHANGELOG.md](https://togithub.com/vitejs/vite/blob/v4.0.5/packages/vite/CHANGELOG.md) for details. ### [`v4.0.4`](https://togithub.com/vitejs/vite/blob/HEAD/packages/vite/CHANGELOG.md#small404-2023-01-03-small) [Compare Source](https://togithub.com/vitejs/vite/compare/v4.0.3...v4.0.4) - fix: importmap should insert before module preload link ([#11492](https://togithub.com/vitejs/vite/issues/11492)) ([25c64d7](https://togithub.com/vitejs/vite/commit/25c64d7)), closes [#11492](https://togithub.com/vitejs/vite/issues/11492) - fix: server.host with ipv6 missed \[] (fix [#11466](https://togithub.com/vitejs/vite/issues/11466)) ([#11509](https://togithub.com/vitejs/vite/issues/11509)) ([2c38bae](https://togithub.com/vitejs/vite/commit/2c38bae)), closes [#11466](https://togithub.com/vitejs/vite/issues/11466) [#11509](https://togithub.com/vitejs/vite/issues/11509) - fix: stop considering parent URLs as public file ([#11145](https://togithub.com/vitejs/vite/issues/11145)) ([568a014](https://togithub.com/vitejs/vite/commit/568a014)), closes [#11145](https://togithub.com/vitejs/vite/issues/11145) - fix(build): invalidate chunk hash when css changed ([#11475](https://togithub.com/vitejs/vite/issues/11475)) ([7a97a04](https://togithub.com/vitejs/vite/commit/7a97a04)), closes [#11475](https://togithub.com/vitejs/vite/issues/11475) - fix(cli): ctrl+C no longer kills processes ([#11434](https://togithub.com/vitejs/vite/issues/11434)) ([#11518](https://togithub.com/vitejs/vite/issues/11518)) ([718fc1d](https://togithub.com/vitejs/vite/commit/718fc1d)), closes [#11434](https://togithub.com/vitejs/vite/issues/11434) [#11518](https://togithub.com/vitejs/vite/issues/11518) - fix(cli): revert ctrl+C no longer kills processes ([#11434](https://togithub.com/vitejs/vite/issues/11434)) ([#11518](https://togithub.com/vitejs/vite/issues/11518)) ([#11562](https://togithub.com/vitejs/vite/issues/11562)) ([3748acb](https://togithub.com/vitejs/vite/commit/3748acb)), closes [#11434](https://togithub.com/vitejs/vite/issues/11434) [#11518](https://togithub.com/vitejs/vite/issues/11518) [#11562](https://togithub.com/vitejs/vite/issues/11562) - fix(optimizer): check .vite/deps directory existence before removing ([#11499](https://togithub.com/vitejs/vite/issues/11499)) ([1b043f9](https://togithub.com/vitejs/vite/commit/1b043f9)), closes [#11499](https://togithub.com/vitejs/vite/issues/11499) - fix(ssr): emit js sourcemaps for ssr builds ([#11343](https://togithub.com/vitejs/vite/issues/11343)) ([f12a1ab](https://togithub.com/vitejs/vite/commit/f12a1ab)), closes [#11343](https://togithub.com/vitejs/vite/issues/11343) - chore: update license ([#11476](https://togithub.com/vitejs/vite/issues/11476)) ([3d346c0](https://togithub.com/vitejs/vite/commit/3d346c0)), closes [#11476](https://togithub.com/vitejs/vite/issues/11476) - chore(deps): update dependency [@rollup/plugin-json](https://togithub.com/rollup/plugin-json) to v6 ([#11553](https://togithub.com/vitejs/vite/issues/11553)) ([3647d07](https://togithub.com/vitejs/vite/commit/3647d07)), closes [#11553](https://togithub.com/vitejs/vite/issues/11553)Configuration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.