Skip to content

`vite preview` path traversal vulnerability on Windows

Moderate
Rich-Harris published GHSA-xgrj-p7pg-6vm3 Oct 5, 2026

Package

npm @sveltejs/kit (npm)

Affected versions

>= 2.10.0

Patched versions

3.0.0

Description

Impact

SvelteKit’s preview server (vite preview) has a path traversal vulnerability on Windows. An unauthenticated attacker who can reach the preview server can send a specially crafted request to read files outside the prerendered output directory. This could expose sensitive files readable by the server process, such as application source code, configuration, or credentials.
The vulnerability was introduced in @sveltejs/kit 2.10.0. It affects preview servers running on Windows, particularly when exposed to untrusted clients through network access or a tunnel. The development server, production adapters, and preview servers running on other operating systems are not affected.

Patches

The issue is fixed in @sveltejs/kit 3.0.0. Users should upgrade to 3.0.0 or later.

Workarounds

Until upgrading, prevent untrusted clients from accessing the preview server. Keep it bound to localhost (avoid using the --host flag or preview.host configuration, especially on untrusted networks), remove public tunnels, and restrict network access as appropriate.

Running the preview server on a non-Windows operating system also avoids this vulnerability.

Severity

Moderate

CVE ID

No known CVE

Weaknesses

Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. Learn more on MITRE.

Credits