{"id":"CVE-2025-31486","aliases":["CVE-2025-31486","GHSA-xcj6-pq6g-qj4x"],"related":[],"kind":"vulnerability","state":"published","title":"Vite allows server.fs.deny to be bypassed with .svg or relative paths","summary":"Vite is a frontend tooling framework for javascript. The contents of arbitrary files can be returned to the browser. By adding ?.svg with ?.wasm?init or with sec-fetch-dest: script header, the server.fs.deny 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+. Only apps explicitly exposing the Vite dev server to the network (using --host or server.host config option) are affected. This vulnerability is fixed in 4.5.12, 5.4.17, 6.0.14, 6.1.4, and 6.2.5.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Vite is a frontend tooling framework for javascript. The contents of arbitrary files can be returned to the browser. By adding ?.svg with ?.wasm?init or with sec-fetch-dest: script header, the server.fs.deny 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+. Only apps explicitly exposing the Vite dev server to the network (using --host or server.host config option) are affected. This vulnerability is fixed in 4.5.12, 5.4.17, 6.0.14, 6.1.4, and 6.2.5.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nThe contents of arbitrary files can be returned to the browser.\n\n### Impact\n\nOnly apps explicitly exposing the Vite dev server to the network (using --host or [server.host config option](https://vitejs.dev/config/server-options.html#server-host)) are affected.\n\n### Details\n\n#### `.svg`\n\nRequests ending with `.svg` are loaded at this line.\nhttps://github.com/vitejs/vite/blob/037f801075ec35bb6e52145d659f71a23813c48f/packages/vite/src/node/plugins/asset.ts#L285-L290\nBy adding `?.svg` with `?.wasm?init` or with `sec-fetch-dest: script` header, the restriction was able to bypass.\n\nThis bypass is only possible if the file is smaller than [`build.assetsInlineLimit`](https://vite.dev/config/build-options.html#build-assetsinlinelimit) (default: 4kB) and when using Vite 6.0+.\n\n#### relative paths\n\nThe check was applied before the id normalization. This allowed requests to bypass with relative paths (e.g. `../../`).\n\n### PoC\n\n```bash\nnpm create vite@latest\ncd vite-project/\nnpm install\nnpm run dev\n```\n\nsend request to read `etc/passwd`\n\n```bash\ncurl 'http://127.0.0.1:5173/etc/passwd?.svg?.wasm?init'\n```\n\n```bash\ncurl 'http://127.0.0.1:5173/@fs/x/x/x/vite-project/?/../../../../../etc/passwd?import&?raw'\n```","format":"markdown","source":"ghsa"},{"lang":"es","text":"Vite es un framework de herramientas frontend para JavaScript. El contenido de archivos arbitrarios se puede devolver al navegador. Al añadir ?.svg con ?.wasm?init o con el encabezado de script sec-fetch-dest:, se pudo omitir la restricción server.fs.deny. Esta omisión solo es posible si el archivo es menor que build.assetsInlineLimit (valor predeterminado: 4 KB) y al usar Vite 6.0 o posterior. Solo se ven afectadas las aplicaciones que exponen explícitamente el servidor de desarrollo de Vite a la red (mediante la opción de configuración --host o server.host). Esta vulnerabilidad se corrigió en las versiones 4.5.12, 5.4.17, 6.0.14, 6.1.4 y 6.2.5.","source":"nvd"}],"published":"2025-04-03T18:24:39.616Z","modified":"2026-09-10T03:49:36.567Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N","score":5.3,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N","score":5.3,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N","score":5.3,"rating":"MEDIUM"}],"cwes":["CWE-200","CWE-284"],"affected":[{"ranges":[{"version":"< 4.5.12","status":"affected"},{"version":">=5.0.0, < 5.4.17","status":"affected"},{"version":">=6.0.0, < 6.0.14","status":"affected"},{"version":">=6.1.0, < 6.1.4","status":"affected"},{"version":">=6.2.0, < 6.2.5","status":"affected"}],"vendor":"vitejs","product":"vite","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"6.2.0","status":"affected","fixed":"6.2.5"}],"ecosystem":"npm","package":"vite","purl":"pkg:npm/vite","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"6.1.0","status":"affected","fixed":"6.1.4"}],"ecosystem":"npm","package":"vite","purl":"pkg:npm/vite","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"6.0.0","status":"affected","fixed":"6.0.14"}],"ecosystem":"npm","package":"vite","purl":"pkg:npm/vite","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"5.0.0","status":"affected","fixed":"5.4.17"}],"ecosystem":"npm","package":"vite","purl":"pkg:npm/vite","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"4.5.12"}],"ecosystem":"npm","package":"vite","purl":"pkg:npm/vite","source":"ghsa"}],"references":[{"url":"https://github.com/vitejs/vite/security/advisories/GHSA-xcj6-pq6g-qj4x","tags":["exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/vitejs/vite/commit/62d7e81ee189d65899bb65f3263ddbd85247b647","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/vitejs/vite/blob/037f801075ec35bb6e52145d659f71a23813c48f/packages/vite/src/node/plugins/asset.ts#L285-L290","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-31486","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/vitejs/vite","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2025-04-03T20:39:24.672Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-31486","url":"https://www.cve.org/CVERecord?id=CVE-2025-31486","licence":"CVE Terms of Use","modified":"2025-04-03T20:39:28.939Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-xcj6-pq6g-qj4x","url":"https://github.com/advisories/GHSA-xcj6-pq6g-qj4x","licence":"CC-BY-4.0","modified":"2026-09-10T03:49:36.567Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-31486","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-31486","licence":"Public domain","modified":"2026-06-17T09:10:29.170Z"}],"updatedAt":"2026-11-25T22:58:56.017Z","epss":{"score":0.01735,"percentile":0.78144,"date":"2026-11-30T12:00:22.000Z"}}