Packages / @nuxt/vite-builder / Security

ModerateVulnerabilityGHSA-2452-6xj8-jh47CVE-2025-24360Published 27 Jan 2025

Opening a malicious website while running a Nuxt dev server could allow read-only access to code

Affected releases · @nuxt/vite-builder

  • 3.x3.8.1 – 3.15.2Fixed in 3.15.3

On 3.x, the newest line:

npm install @nuxt/vite-builder@3.15.3
4.x
  1. Not affected

    4.0.0 – 4.6.2

    25 releases, latest

3.x
  1. Not affected

    3.0.0 – 3.8.0

    32 releases

  2. Affected

    3.8.1 – 3.15.2

    27 releases

  3. Fixed

    3.15.3 – 3.21.11

    33 releases

130 stable releases of @nuxt/vite-builder, oldest to newest, one row per major.

Is your project affected?

Paste your package.json, or type the range you declare for @nuxt/vite-builder. It is read in your browser and sent nowhere.

What happens

Summary

Nuxt allows any websites to send any requests to the development server and read the response due to default CORS settings.

Details

While Vite patched the default CORS settings to fix github.com/vitejs/vite/security/advisories/GHSA…, nuxt uses its own CORS handler by default (#23995).

github.com/nuxt/nuxt/blob/7d345c71462d90187fd09…

That CORS handler sets Access-Control-Allow-Origin: *.

[!IMPORTANT]
If on an affected version, it may be possible to opt-out of the default Nuxt CORS handler by configuring vite.server.cors.

PoC

  1. Start a dev server in any nuxt project using Vite by nuxt dev.

  2. Send a fetch request to http://localhost:3000/_nuxt/app.vue (fetch('http://localhost:3000/_nuxt/app.vue')) from a different origin page.

Impact

Users with the default server.cors option using Vite builder may get the source code stolen by malicious websites

Additional Information

/__nuxt_vite_node__/manifest / /__nuxt_vite_node__/module also seems to have Access-Control-Allow-Origin: *, so it maybe also possible to exploit that handler. github.com/nuxt/nuxt/blob/7d345c71462d90187fd09… Although I didn't find a valid module id. Note that this handler is probably also vulnerable to DNS rebinding attacks as I didn't find any host header checks.