CVE-2025-58752: Vite Vite's `server.fs` Settings Were Not Vulnerability
LOWCVE-2025-58752 is a LOW vite's `server.fs` settings were not vulnerability (CWE-284: Improper Access Control) affecting Vite libraries in the npm ecosystem. The issue involves vite's `server.fs` settings were not applied to html files. Remediation is available by upgrading affected packages to version 7.1.5, 7.0.7, 6.3.6, 5.4.20.
CVE-2025-58752 at a Glance
How to Fix CVE-2025-58752
To remediate this vulnerability, upgrade all affected Vite dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install vite@7.1.5
npm install vite@7.0.7
npm install vite@6.3.6
npm install vite@5.4.20
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls vite
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2025-58752, inspect your project dependencies using npm:
npm ls vite
Analyze the terminal output to locate any version of Vite in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 7.1.5), your application is affected.
Note: The npm ls vite command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-284: Improper Access Control, where the product does not restrict or incorrectly restricts access to a resource from an unauthorized actor. In Vite, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2025-58752 Affected Vite Versions
4 component(s)References
Frequently Asked Questions
What is CVE-2025-58752?
Which Vite versions are affected?
What version fixes CVE-2025-58752?
Is vite affected?
What CWE is associated with CVE-2025-58752?
How can I check npm dependencies for CVE-2025-58752?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-jqfw-vq24-v9c3",
"modified" : "2025-09-09T20:54:42Z",
"published" : "2025-09-09T20:54:42Z",
"aliases" : [ "CVE-2025-58752" ],
"summary" : "Vite's `server.fs` settings were not applied to HTML files",
"details" : "### Summary\nAny HTML files on the machine were served regardless of the `server.fs` settings.\n\n### Impact\n\nOnly apps that match the following conditions are affected:\n\n- explicitly exposes the Vite dev server to the network (using --host or [server.host config option](https://vitejs.dev/config/server-options.html#server-host))\n- `appType: 'spa'` (default) or `appType: 'mpa'` is used\n\nThis vulnerability also affects the preview server. The preview server allowed HTML files not under the output directory to be served.\n\n### Details\nThe [serveStaticMiddleware](https://github.com/vitejs/vite/blob/9719497adec4ad5ead21cafa19a324bb1d480194/packages/vite/src/node/server/middlewares/static.ts#L123) function is in charge of serving static files from the server. It returns the [viteServeStaticMiddleware](https://github.com/vitejs/vite/blob/9719497adec4ad5ead21cafa19a324bb1d480194/packages/vite/src/node/server/middlewares/static.ts#L136) function which runs the needed tests and serves the page. The viteServeStaticMiddleware function [checks if the extension of the requested file is \".html\"](https://github.com/vitejs/vite/blob/9719497adec4ad5ead21cafa19a324bb1d480194/packages/vite/src/node/server/middlewares/static.ts#L144). If so, it doesn't serve the page. Instead, the server will go on to the next middlewares, in this case [htmlFallbackMiddleware](https://github.com/vitejs/vite/blob/9719497adec4ad5ead21cafa19a324bb1d480194/packages/vite/src/node/server/middlewares/htmlFallback.ts#L14), and then to [indexHtmlMiddleware](https://github.com/vitejs/vite/blob/9719497adec4ad5ead21cafa19a324bb1d480194/packages/vite/src/node/server/middlewares/indexHtml.ts#L438). 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.\n\n### PoC\nExecute the following shell commands:\n\n```\nnpm create vite@latest\ncd vite-project/\necho \"secret\" > /tmp/secret.html\nnpm install\nnpm run dev\n```\n\nThen, in a different shell, run the following command:\n\n`curl -v --path-as-is 'http://localhost:5173/../../../../../../../../../../../tmp/secret.html'`\n\nThe contents of /tmp/secret.html will be returned.\n\nThis 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:\n\n```\necho '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)\nmkdir secret_files\necho \"secret txt\" > secret_files/secret.txt\necho \"secret html\" > secret_files/secret.html\nnpm run dev\n\n```\n\nThen, in a different shell, run the following command:\n\n`curl -v --path-as-is 'http://localhost:5173/secret_files/secret.txt'`\n\nYou will receive a 403 HTTP Response, because everything in the secret_files directory is denied.\n\nNow in the same shell run the following command:\n\n`curl -v --path-as-is 'http://localhost:5173/secret_files/secret.html'`\n\nYou will receive the contents of secret_files/secret.html.",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "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"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "vite"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "7.1.0"
}, {
"fixed" : "7.1.5"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 7.1.4"
}
}, {
"package" : {
"ecosystem" : "npm",
"name" : "vite"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "7.0.0"
}, {
"fixed" : "7.0.7"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 7.0.6"
}
}, {
"package" : {
"ecosystem" : "npm",
"name" : "vite"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "6.0.0"
}, {
"fixed" : "6.3.6"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 6.3.5"
}
}, {
"package" : {
"ecosystem" : "npm",
"name" : "vite"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "5.4.20"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 5.4.19"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/vitejs/vite/security/advisories/GHSA-jqfw-vq24-v9c3"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-58752"
}, {
"type" : "WEB",
"url" : "https://github.com/vitejs/vite/commit/0ab19ea9fcb66f544328f442cf6e70f7c0528d5f"
}, {
"type" : "WEB",
"url" : "https://github.com/vitejs/vite/commit/14015d794f69accba68798bd0e15135bc51c9c1e"
}, {
"type" : "WEB",
"url" : "https://github.com/vitejs/vite/commit/482000f57f56fe6ff2e905305100cfe03043ddea"
}, {
"type" : "WEB",
"url" : "https://github.com/vitejs/vite/commit/6f01ff4fe072bcfcd4e2a84811772b818cd51fe6"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/vitejs/vite"
}, {
"type" : "WEB",
"url" : "https://github.com/vitejs/vite/blob/v7.1.5/packages/vite/CHANGELOG.md"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-200", "CWE-23", "CWE-284" ],
"severity" : "LOW",
"github_reviewed" : true,
"github_reviewed_at" : "2025-09-09T20:54:42Z",
"nvd_published_at" : "2025-09-08T23:15:36Z"
}
}