4.8medium
server.fs.deny bypassed when using ?import&raw in vite
- Severity
- 4.8medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 1.10% (higher than 66% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-9cwx-2883-4wfx
Description
Vite a frontend build tooling framework for javascript. In affected versions the contents of arbitrary files can be returned to the browser. `@fs` denies access to files outside of Vite serving allow list. Adding `?import&raw` to the URL bypasses this limitation and returns the file content if it exists. This issue has been patched in versions 5.4.6, 5.3.6, 5.2.14, 4.5.5, and 3.2.11. Users are advised to upgrade. There are no known workarounds for this vulnerability.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| vitejs vite | >= 5.4.0, < 5.4.6, >= 5.3.0, < 5.3.6, >= 5.0.0, < 5.2.14, >= 4.0.0, < 4.5.5, < 3.2.11, from 5.4.0 before 5.4.6, from 5.3.0 before 5.3.6, from 5.0.0 before 5.2.14 and 2 more | CVE List |
| vite (npm) | from 5.4.0 before 5.4.6, from 5.3.0 before 5.3.6, from 5.2.0 before 5.2.14, from 4.0.0 before 4.5.4, before 3.2.11, from 5.0.0 before 5.1.8 | GitHub Advisory Database |
All scores
| GitHub_M | 4.8medium CVSS:3.1 | CVSS:3.1/AV:A/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N |
| GitHub | 5.3medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N |
| GitHub | medium CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N |
Classification
What each source says
CVE List
Vite a frontend build tooling framework for javascript. In affected versions the contents of arbitrary files can be returned to the browser. `@fs` denies access to files outside of Vite serving allow list. Adding `?import&raw` to the URL bypasses this limitation and returns the file content if it exists. This issue has been patched in versions 5.4.6, 5.3.6, 5.2.14, 4.5.5, and 3.2.11. Users are advised to upgrade. There are no known workarounds for this vulnerability.
GitHub Advisory Database
Summary
The contents of arbitrary files can be returned to the browser.
Details
@fs denies access to files outside of Vite serving allow list. Adding ?import&raw to the URL bypasses this limitation and returns the file content if it exists.
PoC
$ npm create vite@latest
$ cd vite-project/
$ npm install
$ npm run dev
$ echo "top secret content" > /tmp/secret.txt
# expected behaviour
$ curl "http://localhost:5173/@fs/tmp/secret.txt"
<body>
<h1>403 Restricted</h1>
<p>The request url "/tmp/secret.txt" is outside of Vite serving allow list.
# security bypassed
$ curl "http://localhost:5173/@fs/tmp/secret.txt?import&raw"
export default "top secret content\n"
//# sourceMappingURL=data:application/json;base64,eyJ2...
NVD (es)
Vite es un framework de herramientas de compilación de interfaz para JavaScript. En las versiones afectadas, el contenido de archivos arbitrarios se puede devolver al navegador. `@fs` niega el acceso a archivos fuera de la lista de permitidos de Vite. Agregar `?import&raw` a la URL evita esta limitación y devuelve el contenido del archivo si existe. Este problema se ha corregido en las versiones 5.4.6, 5.3.6, 5.2.14, 4.5.5 y 3.2.11. Se recomienda a los usuarios que actualicen. No existen workarounds para esta vulnerabilidad.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2024-45811 changed 2024-09-18 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-9cwx-2883-4wfx changed 2026-09-10 | CC-BY-4.0 |
| NVD | CVE-2024-45811 changed 2026-06-17 | Public domain |