Skip to content

Update dependency vite to v6.4.2 [SECURITY]#99

Open
renovate[bot] wants to merge 1 commit intothe-onefrom
renovate/npm-vite-vulnerability
Open

Update dependency vite to v6.4.2 [SECURITY]#99
renovate[bot] wants to merge 1 commit intothe-onefrom
renovate/npm-vite-vulnerability

Conversation

@renovate
Copy link
Copy Markdown
Contributor

@renovate renovate Bot commented Mar 25, 2025

ℹ️ Note

This PR body was truncated due to platform limits.

This PR contains the following updates:

Package Change Age Confidence
vite (source) 6.0.116.4.2 age confidence

Warning

Some dependencies could not be looked up. Check the warning logs for more information.


Vite bypasses server.fs.deny when using ?raw??

CVE-2025-30208 / GHSA-x574-m823-4x7w

More information

Details

Summary

The contents of arbitrary files can be returned to the browser.

Impact

Only apps explicitly exposing the Vite dev server to the network (using --host or server.host config option) are affected.

Details

@fs denies access to files outside of Vite serving allow list. Adding ?raw?? or ?import&raw?? to the URL bypasses this limitation and returns the file content if it exists. This bypass exists because trailing separators such as ? are removed in several places, but are not accounted for in query string regexes.

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/@&#8203;fs/tmp/secret.txt?import&raw??"
export default "top secret content\n"
//# sourceMappingURL=data:application/json;base64,eyJ2...

Severity

  • CVSS Score: 5.3 / 10 (Medium)
  • Vector String: CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Vite has a server.fs.deny bypassed for inline and raw with ?import query

CVE-2025-31125 / GHSA-4r4m-qw57-chr8

More information

Details

Summary

The contents of arbitrary files can be returned to the browser.

Impact

Only apps explicitly exposing the Vite dev server to the network (using --host or server.host config option) are affected.

Details
  • base64 encoded content of non-allowed files is exposed using ?inline&import (originally reported as ?import&?inline=1.wasm?init)
  • content of non-allowed files is exposed using ?raw?import

/@&#8203;fs/ isn't needed to reproduce the issue for files inside the project root.

PoC

Original report (check details above for simplified cases):

The ?import&?inline=1.wasm?init ending allows attackers to read arbitrary files and returns the file content if it exists. Base64 decoding needs to be performed twice

$ npm create vite@latest
$ cd vite-project/
$ npm install
$ npm run dev

Example full URL http://localhost:5173/@&#8203;fs/C:/windows/win.ini?import&?inline=1.wasm?init

Severity

  • CVSS Score: 5.3 / 10 (Medium)
  • Vector String: CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Vite allows server.fs.deny to be bypassed with .svg or relative paths

CVE-2025-31486 / GHSA-xcj6-pq6g-qj4x

More information

Details

Summary

The contents of arbitrary files can be returned to the browser.

Impact

Only apps explicitly exposing the Vite dev server to the network (using --host or server.host config option) are affected.

Details
.svg

Requests ending with .svg are loaded at this line.
https://github.com/vitejs/vite/blob/037f801075ec35bb6e52145d659f71a23813c48f/packages/vite/src/node/plugins/asset.ts#L285-L290
By adding ?.svg with ?.wasm?init or with sec-fetch-dest: script header, the restriction was able to bypass.

This bypass is only possible if the file is smaller than build.assetsInlineLimit (default: 4kB) and when using Vite 6.0+.

relative paths

The check was applied before the id normalization. This allowed requests to bypass with relative paths (e.g. ../../).

PoC
npm create vite@latest
cd vite-project/
npm install
npm run dev

send request to read etc/passwd

curl 'http://127.0.0.1:5173/etc/passwd?.svg?.wasm?init'
curl 'http://127.0.0.1:5173/@&#8203;fs/x/x/x/vite-project/?/../../../../../etc/passwd?import&?raw'

Severity

  • CVSS Score: 5.3 / 10 (Medium)
  • Vector String: CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Vite's server.fs.deny bypassed with /. for files under project root

CVE-2025-46565 / GHSA-859w-5945-r5v3

More information

Details

Summary

The contents of files in the project root that are denied by a file matching pattern can be returned to the browser.

Impact

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.

  • Examples of file matching patterns: .env, .env.*, *.{crt,pem}, **/.env
  • Examples of other patterns: **/.git/**, .git/**, .git/**/*
Details

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 (/.).

PoC
npm create vite@latest
cd vite-project/
cat "secret" > .env
npm install
npm run dev
curl --request-target /.env/. http://localhost:5173

image
image

Severity

  • CVSS Score: 6.0 / 10 (Medium)
  • Vector String: CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Vite middleware may serve files starting with the same name with the public directory

CVE-2025-58751 / GHSA-g4jq-h2w9-997c

More information

Details

Summary

Files starting with the same name with the public directory were served bypassing the server.fs settings.

Impact

Only apps that match the following conditions are affected:

Details

The servePublicMiddleware function is in charge of serving public files from the server. It returns the viteServePublicMiddleware function which runs the needed tests and serves the page. The viteServePublicMiddleware function checks if the publicFiles variable is defined, and then uses it to determine if the requested page is public. In the case that the publicFiles is undefined, the code will treat the requested page as a public page, and go on with the serving function. publicFiles may be undefined if there is a symbolic link anywhere inside the public directory. In that case, every requested page will be passed to the public serving function. The serving function is based on the sirv library. Vite patches the library to add the possibility to test loading access to pages, but when the public page middleware disables this functionality since public pages are meant to be available always, regardless of whether they are in the allow or deny list.

In the case of public pages, the serving function is provided with the path to the public directory as a root directory. The code of the sirv library uses the join function to get the full path to the requested file. For example, if the public directory is "/www/public", and the requested file is "myfile", the code will join them to the string "/www/public/myfile". The code will then pass this string to the normalize function. Afterwards, the code will use the string's startsWith function to determine whether the created path is within the given directory or not. Only if it is, it will be served.

Since sirv trims the trailing slash of the public directory, the string's startsWith function may return true even if the created path is not within the public directory. For example, if the server's root is at "/www", and the public directory is at "/www/p", if the created path will be "/www/private.txt", the startsWith function will still return true, because the string "/www/private.txt" starts with  "/www/p". To achieve this, the attacker will use ".." to ask for the file "../private.txt". The code will then join it to the "/www/p" string, and will receive "/www/p/../private.txt". Then, the normalize function will return "/www/private.txt", which will then be passed to the startsWith function, which will return true, and the processing of the page will continue without checking the deny list (since this is the public directory middleware which doesn't check that).

PoC

Execute the following shell commands:

npm  create  vite@latest
cd vite-project/
mkdir p
cd p
ln -s a b
cd ..
echo  'import path from "node:path"; import { defineConfig } from "vite"; export default defineConfig({publicDir: path.resolve(__dirname, "p/"), server: {fs: {deny: [path.resolve(__dirname, "private.txt")]}}})' > vite.config.js
echo  "secret" > private.txt
npm install
npm run dev

Then, in a different shell, run the following command:

curl -v --path-as-is 'http://localhost:5173/private.txt'

You will receive a 403 HTTP Response,  because private.txt is denied.

Now in the same shell run the following command:

curl -v --path-as-is 'http://localhost:5173/../private.txt'

You will receive the contents of private.txt.

Related links

Severity

  • CVSS Score: 2.3 / 10 (Low)
  • Vector String: CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Vite's server.fs settings were not applied to HTML files

CVE-2025-58752 / GHSA-jqfw-vq24-v9c3

More information

Details

Summary

Any HTML files on the machine were served regardless of the server.fs settings.

Impact

Only apps that match the following conditions are affected:

  • explicitly exposes the Vite dev server to the network (using --host or server.host config option)
  • appType: 'spa' (default) or appType: 'mpa' is used

This vulnerability also affects the preview server. The preview server allowed HTML files not under the output directory to be served.

Details

The serveStaticMiddleware function is in charge of serving static files from the server. It returns the viteServeStaticMiddleware function which runs the needed tests and serves the page. The viteServeStaticMiddleware function checks if the extension of the requested file is ".html". If so, it doesn't serve the page. Instead, the server will go on to the next middlewares, in this case htmlFallbackMiddleware, and then to indexHtmlMiddleware. These middlewares don't perform any test against allow or deny rules, and they don't make sure that the accessed file is in the root directory of the server. They just find the file and send back its contents to the client.

PoC

Execute the following shell commands:

npm  create  vite@latest
cd vite-project/
echo  "secret" > /tmp/secret.html
npm install
npm run dev

Then, in a different shell, run the following command:

curl -v --path-as-is 'http://localhost:5173/../../../../../../../../../../../tmp/secret.html'

The contents of /tmp/secret.html will be returned.

This will also work for HTML files that are in the root directory of the project, but are in the deny list (or not in the allow list). Test that by stopping the running server (CTRL+C), and running the following commands in the server's shell:

echo  'import path from "node:path"; import { defineConfig } from "vite"; export default defineConfig({server: {fs: {deny: [path.resolve(__dirname, "secret_files/*")]}}})'  >  [vite.config.js](http://vite.config.js)
mkdir secret_files
echo "secret txt" > secret_files/secret.txt
echo "secret html" > secret_files/secret.html
npm run dev

Then, in a different shell, run the following command:

curl -v --path-as-is 'http://localhost:5173/secret_files/secret.txt'

You will receive a 403 HTTP Response,  because everything in the secret_files directory is denied.

Now in the same shell run the following command:

curl -v --path-as-is 'http://localhost:5173/secret_files/secret.html'

You will receive the contents of secret_files/secret.html.

Severity

  • CVSS Score: 2.3 / 10 (Low)
  • Vector String: CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


vite allows server.fs.deny bypass via backslash on Windows

CVE-2025-62522 / GHSA-93m4-6634-74q7

More information

Details

Summary

Files denied by server.fs.deny were sent if the URL ended with \ when the dev server is running on Windows.

Impact

Only apps that match the following conditions are affected:

  • explicitly exposes the Vite dev server to the network (using --host or server.host config option)
  • running the dev server on Windows
Details

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 by using a back slash(\). The root cause is that fs.readFile('/foo.png/') loads /foo.png.

PoC
npm create vite@latest
cd vite-project/
cat "secret" > .env
npm install
npm run dev
curl --request-target /.env\ http://localhost:5173
image

Severity

  • CVSS Score: 6.0 / 10 (Medium)
  • Vector String: CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Vite Vulnerable to Arbitrary File Read via Vite Dev Server WebSocket

CVE-2026-39363 / GHSA-p9ff-h696-f583

More information

Details

Summary

server.fs check was not enforced to the fetchModule method that is exposed in Vite dev server's WebSocket.

Impact

Only apps that match the following conditions are affected:

  • explicitly exposes the Vite dev server to the network (using --host or server.host config option)
  • WebSocket is not disabled by server.ws: false

Arbitrary files on the server (development machine, CI environment, container, etc.) can be exposed.

Details

If it is possible to connect to the Vite dev server’s WebSocket without an Origin header, an attacker can invoke fetchModule via the custom WebSocket event vite:invoke and combine file://... with ?raw (or ?inline) to retrieve the contents of arbitrary files on the server as a JavaScript string (e.g., export default "...").

The access control enforced in the HTTP request path (such as server.fs.allow) is not applied to this WebSocket-based execution path.

PoC
  1. Start the dev server on the target
    Example (used during validation with this repository):

    pnpm -C playground/alias exec vite --host 0.0.0.0 --port 5173
  2. Confirm that access is blocked via the HTTP path (example: arbitrary file)

    curl -i 'http://localhost:5173/@&#8203;fs/etc/passwd?raw'

    Result: 403 Restricted (outside the allow list)
    image

  3. Confirm that the same file can be retrieved via the WebSocket path
    By connecting to the HMR WebSocket without an Origin header and sending a vite:invoke request that calls fetchModule with a file://... URL and ?raw, the file contents are returned as a JavaScript module.

image image

Severity

  • CVSS Score: 8.2 / 10 (High)
  • Vector String: CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Vite Vulnerable to Path Traversal in Optimized Deps .map Handling

CVE-2026-39365 / GHSA-4w7w-66w2-5vf9

More information

Details

Summary

Any files ending with .map even out side the project can be returned to the browser.

Impact

Only apps that match the following conditions are affected:

  • explicitly exposes the Vite dev server to the network (using --host or server.host config option)
  • have a sensitive content in files ending with .map and the path is predictable
Details

In Vite v7.3.1, the dev server’s handling of .map requests for optimized dependencies resolves file paths and calls readFile without restricting ../ segments in the URL. As a result, it is possible to bypass the server.fs.strict allow list and retrieve .map files located outside the project root, provided they can be parsed as valid source map JSON.

PoC
  1. Create a minimal PoC sourcemap outside the project root
    cat > /tmp/poc.map <<'EOF'
    {"version":3,"file":"x.js","sources":[],"names":[],"mappings":""}
    EOF
  2. Start the Vite dev server (example)
    pnpm -C playground/fs-serve dev --host 127.0.0.1 --port 18080
  3. Confirm that direct /@&#8203;fs access is blocked by strict (returns 403)
    image
  4. Inject ../ segments under the optimized deps .map URL prefix to reach /tmp/poc.map
    image

Severity

  • CVSS Score: 6.3 / 10 (Medium)
  • Vector String: CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Release Notes

vitejs/vite (vite)

v6.4.2

Compare Source

Please refer to CHANGELOG.md for details.

v6.4.1

Compare Source

Please refer to CHANGELOG.md for details.

v6.4.0

Compare Source

Please refer to CHANGELOG.md for details.

v6.3.7

Compare Source

Please refer to CHANGELOG.md for details.

v6.3.6

Compare Source

Please refer to CHANGELOG.md for details.

v6.3.5

Compare Source

Vite 7 is out!

Today, we're excited to announce the release of the next Vite major:

⚠ BREAKING CHANGES
  • ssr: don't access Object variable in ssr transformed code (#​19996)
  • remove experimental.skipSsrTransform option (#​20038)
  • remove HotBroadcaster (#​19988)
  • css: always use sass compiler API (#​19978)
  • bump build.target and name it baseline-widely-available (#​20007)
  • bump required node version to 20.19+, 22.12+ and remove cjs build (#​20032)
  • css: remove sass legacy API support (#​19977)
  • remove deprecated HotBroadcaster related types (#​19987)
  • remove deprecated no-op type only properties (#​19985)
  • remove node 18 support (#​19972)
  • remove deprecated hook-level enforce/transform from transformIndexHtml hook (#​19349)
  • remove deprecated splitVendorChunkPlugin (#​19255)
Features
Bug Fixes
Performance Improvements
Documentation
Miscellaneous Chores
Code Refactoring
Tests
Continuous Integration
Beta Changelogs
7.0.0-beta.2 (2025-06-17)

See 7.0.0-beta.2 changelog

7.0.0-beta.1 (2025-06-10)

See 7.0.0-beta.1 changelog

7.0.0-beta.0 (2025-06-02)

See 7.0.0-beta.0 changelog

[v6.3.4](https://redirect.github.com/vitejs/vite/blob/HEAD/packages/

Note

PR body was truncated to here.


Configuration

📅 Schedule: (UTC)

  • Branch creation
    • ""
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 25, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review

Comment @coderabbitai help to get the list of available commands and usage tips.

@renovate renovate Bot changed the title Update dependency vite to v6.0.12 [SECURITY] Update dependency vite to v6.0.13 [SECURITY] Mar 31, 2025
@renovate renovate Bot force-pushed the renovate/npm-vite-vulnerability branch from 4ed2f0b to 2f79462 Compare March 31, 2025 22:22
@renovate renovate Bot changed the title Update dependency vite to v6.0.13 [SECURITY] Update dependency vite to v6.0.14 [SECURITY] Apr 4, 2025
@renovate renovate Bot force-pushed the renovate/npm-vite-vulnerability branch from 2f79462 to faf198f Compare April 4, 2025 19:36
@renovate renovate Bot force-pushed the renovate/npm-vite-vulnerability branch from faf198f to e583925 Compare April 30, 2025 18:57
@renovate renovate Bot changed the title Update dependency vite to v6.0.14 [SECURITY] Update dependency vite to v6.1.6 [SECURITY] Apr 30, 2025
@renovate renovate Bot force-pushed the renovate/npm-vite-vulnerability branch from e583925 to 520912b Compare May 19, 2025 21:14
@renovate renovate Bot force-pushed the renovate/npm-vite-vulnerability branch from 520912b to 9e62e71 Compare May 28, 2025 15:01
@renovate renovate Bot force-pushed the renovate/npm-vite-vulnerability branch from 9e62e71 to 425ccee Compare June 6, 2025 02:44
@renovate renovate Bot force-pushed the renovate/npm-vite-vulnerability branch from 425ccee to 1966f50 Compare June 22, 2025 12:28
@renovate renovate Bot force-pushed the renovate/npm-vite-vulnerability branch from 1966f50 to 3d6e3ed Compare July 2, 2025 16:11
@renovate renovate Bot force-pushed the renovate/npm-vite-vulnerability branch from 3d6e3ed to 0a920e5 Compare August 10, 2025 12:48
@renovate renovate Bot force-pushed the renovate/npm-vite-vulnerability branch from 0a920e5 to 2a5125b Compare August 19, 2025 13:53
@renovate renovate Bot force-pushed the renovate/npm-vite-vulnerability branch from 2a5125b to c74668b Compare August 31, 2025 10:03
@renovate renovate Bot force-pushed the renovate/npm-vite-vulnerability branch from c74668b to 49e6254 Compare September 10, 2025 02:50
@renovate renovate Bot changed the title Update dependency vite to v6.1.6 [SECURITY] Update dependency vite to v6.3.6 [SECURITY] Sep 10, 2025
@renovate renovate Bot force-pushed the renovate/npm-vite-vulnerability branch from 49e6254 to 37f52dc Compare September 25, 2025 21:02
@renovate renovate Bot force-pushed the renovate/npm-vite-vulnerability branch from 37f52dc to 255485c Compare October 20, 2025 21:52
@renovate renovate Bot changed the title Update dependency vite to v6.3.6 [SECURITY] Update dependency vite to v6.4.1 [SECURITY] Oct 20, 2025
@renovate renovate Bot force-pushed the renovate/npm-vite-vulnerability branch from 255485c to 32d4596 Compare November 10, 2025 13:58
@renovate renovate Bot force-pushed the renovate/npm-vite-vulnerability branch from 32d4596 to b9d617b Compare December 3, 2025 18:33
@renovate renovate Bot force-pushed the renovate/npm-vite-vulnerability branch from b9d617b to d115616 Compare December 31, 2025 15:54
@renovate renovate Bot force-pushed the renovate/npm-vite-vulnerability branch from d115616 to ab3759d Compare January 8, 2026 18:36
@renovate renovate Bot force-pushed the renovate/npm-vite-vulnerability branch 2 times, most recently from 142b2c8 to e2976d1 Compare January 24, 2026 15:06
@renovate renovate Bot force-pushed the renovate/npm-vite-vulnerability branch from e2976d1 to c2658bc Compare February 2, 2026 20:44
@renovate renovate Bot force-pushed the renovate/npm-vite-vulnerability branch from c2658bc to ee088f4 Compare February 12, 2026 11:26
@renovate renovate Bot force-pushed the renovate/npm-vite-vulnerability branch from ee088f4 to ddaf965 Compare March 5, 2026 14:33
@renovate renovate Bot changed the title Update dependency vite to v6.4.1 [SECURITY] Update dependency vite to v6.4.1 [SECURITY] - autoclosed Mar 27, 2026
@renovate renovate Bot closed this Mar 27, 2026
@renovate renovate Bot deleted the renovate/npm-vite-vulnerability branch March 27, 2026 01:29
@renovate renovate Bot changed the title Update dependency vite to v6.4.1 [SECURITY] - autoclosed Update dependency vite to v6.4.1 [SECURITY] Mar 30, 2026
@renovate renovate Bot reopened this Mar 30, 2026
@renovate renovate Bot force-pushed the renovate/npm-vite-vulnerability branch 2 times, most recently from ddaf965 to 98f68b5 Compare March 30, 2026 20:55
@renovate renovate Bot force-pushed the renovate/npm-vite-vulnerability branch from 98f68b5 to 3092247 Compare April 6, 2026 20:57
@renovate renovate Bot changed the title Update dependency vite to v6.4.1 [SECURITY] Update dependency vite to v6.4.2 [SECURITY] Apr 6, 2026
@renovate renovate Bot force-pushed the renovate/npm-vite-vulnerability branch from 3092247 to d1540fa Compare April 8, 2026 20:14
@renovate renovate Bot force-pushed the renovate/npm-vite-vulnerability branch from d1540fa to 3afc4a1 Compare April 29, 2026 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants