CVE-2025-46565 Vite's server.fs.deny bypassed with /. for files under project root

Medium 6.0 Published Updated

Attackers can bypass file access restrictions to read sensitive files like .env from the project root if the Vite dev server is exposed to the network.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2025-46565?

CVE-2025-46565 is a medium-severity path traversal vulnerability in vitejs vite, published on 1 May 2025. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

Official description

Vite is a frontend tooling framework for javascript. Prior to versions 6.3.4, 6.2.7, 6.1.6, 5.4.19, and 4.5.14, the contents of files in the project root that are denied by a file matching pattern can be returned to the browser. Only apps explicitly exposing the Vite dev server to the network (using --host or server.host config option) are affected. Only files that are under project root and are denied by a file matching pattern can be bypassed. `server.fs.deny` can contain patterns matching against files (by default it includes .env, .env.*, *.{crt,pem} as such patterns). These patterns were able to bypass for files under `root` by using a combination of slash and dot (/.). This issue has been patched in versions 6.3.4, 6.2.7, 6.1.6, 5.4.19, and 4.5.14.

Weakness: CWE-22

Which versions are affected by CVE-2025-46565?

10 open source packages ship an affected version, including vite. It affects 1 product.

PackageAffectedFixed in
vite npmAll versions4.5.14
vite npmAll versions4.5.14
vite npmFrom 5.0.05.4.19
vite npmFrom 5.0.05.4.19
vite npmFrom 6.0.06.1.6
vite npmFrom 6.0.06.1.6
4 more packages
vite npmFrom 6.2.06.2.7
vite npmFrom 6.2.06.2.7
vite npmFrom 6.3.06.3.4
vite npmFrom 6.3.06.3.4

Products include Vitejs Vite.

How do I fix CVE-2025-46565?

Upgrade vite to a fixed version for your release line: 4.5.14, 5.4.19, 6.1.6 or 6.2.7.

Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.

Is CVE-2025-46565 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-46565 exists.

Public exploit code: 1 Nuclei template.

Sources

Also known as CLSA-2026-1792764572, GHSA-859w-5945-r5v3, MINI-29w9-27rf-fchp.

Is CVE-2025-46565 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free