CVE-2024-45811 server.fs.deny bypassed when using ?import&raw in vite
Attackers can bypass file access restrictions in Vite to read arbitrary files from the server by appending specific query parameters.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Local or same network only
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is CVE-2024-45811?
CVE-2024-45811 is a medium-severity path traversal vulnerability in vitejs vite, published on 17 Sep 2024. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Official 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.
Which versions are affected by CVE-2024-45811?
12 open source packages ship an affected version, including vite.
| Package | Affected | Fixed in |
|---|---|---|
vite npm | All versions | 3.2.11 |
vite npm | All versions | 3.2.11 |
vite npm | From 4.0.0 | 4.5.4 |
vite npm | From 4.0.0 | 4.5.4 |
vite npm | From 5.0.0 | 5.1.8 |
vite npm | From 5.0.0 | 5.1.8 |
6 more packages
vite npm | From 5.2.0 | 5.2.14 |
vite npm | From 5.2.0 | 5.2.14 |
vite npm | From 5.3.0 | 5.3.6 |
vite npm | From 5.3.0 | 5.3.6 |
vite npm | From 5.4.0 | 5.4.6 |
vite npm | From 5.4.0 | 5.4.6 |
How do I fix CVE-2024-45811?
Upgrade vite to a fixed version for your release line: 3.2.11, 4.5.4, 5.1.8 or 5.2.14.
Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.
Is CVE-2024-45811 being exploited?
It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-45811 exists.
Sources
Also known as GHSA-9cwx-2883-4wfx, MINI-vr88-xv87-mjx9.