{"answers":{"affected":"12 open source packages ship an affected version, including vite.","exploited":"It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-45812 exists.","fix":"Upgrade vite to a fixed version for your release line: 3.2.11, 4.5.4, 5.1.8 or 5.2.14.","what":"CVE-2024-45812 is a medium-severity cross-site scripting vulnerability in vitejs vite, published on 17 Sep 2024. Any signed-in user can exploit it over the network, with no action from the victim."},"fix_prompt":"Check this codebase for CVE-2024-45812 and fix it if it is affected.\n\nWhat it is: CVE-2024-45812 is a medium-severity cross-site scripting vulnerability in vitejs vite, published on 17 Sep 2024. Any signed-in user can exploit it over the network, with no action from the victim.\nExploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-45812 exists.\n\nAffected packages and fixed versions:\n- vite (npm): affected all versions; fixed in 3.2.11\n- vite (npm): affected all versions; fixed in 3.2.11\n- vite (npm): affected from 4.0.0; fixed in 4.5.4\n- vite (npm): affected from 4.0.0; fixed in 4.5.4\n- vite (npm): affected from 5.0.0; fixed in 5.1.8\n- vite (npm): affected from 5.0.0; fixed in 5.1.8\n- vite (npm): affected from 5.2.0; fixed in 5.2.14\n- vite (npm): affected from 5.2.0; fixed in 5.2.14\n- vite (npm): affected from 5.3.0; fixed in 5.3.6\n- vite (npm): affected from 5.3.0; fixed in 5.3.6\n- vite (npm): affected from 5.4.0; fixed in 5.4.6\n- vite (npm): affected from 5.4.0; fixed in 5.4.6\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/CVE-2024-45812/ (Markdown: https://insights.sbomify.com/CVE-2024-45812/index.md)","id":"CVE-2024-45812","markdown":"https://insights.sbomify.com/CVE-2024-45812/index.md","name":"CVE-2024-45812","record":{"aliases":["GHSA-64vr-g452-qvp3","MINI-jpjr-fqm7-2984"],"analysis":{"component_type":"developer_tool","fix_type":"upgrade","impacts":["code_execution"],"network_reachable":"yes","non_default_config":true,"product_category":"Vite build tool","requires_auth":"low_privilege","summary":"Attackers can execute arbitrary JavaScript via DOM clobbering in Vite-bundled scripts using specific output formats, requiring upgrade.","user_interaction":"not_required","vuln_class":"xss"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"GitHub_M","cpe":[],"cvss":{"score":6.4,"severity":"medium","source":"cna","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:H","version":"3.1"},"cwes":[{"id":"CWE-79","name":"Improper Neutralization of Input During Web Page Generation"}],"description":"Vite a frontend build tooling framework for javascript. Affected versions of vite were discovered to contain a DOM Clobbering vulnerability when building scripts to `cjs`/`iife`/`umd` output format. The DOM Clobbering gadget in the module can lead to cross-site scripting (XSS) in web pages where scriptless attacker-controlled HTML elements (e.g., an img tag with an unsanitized name attribute) are present. DOM Clobbering is a type of code-reuse attack where the attacker first embeds a piece of non-script, seemingly benign HTML markups in the webpage (e.g. through a post or comment) and leverages the gadgets (pieces of js code) living in the existing javascript code to transform it into executable code. We have identified a DOM Clobbering vulnerability in Vite bundled scripts, particularly when the scripts dynamically import other scripts from the assets folder and the developer sets the build output format to `cjs`, `iife`, or `umd`. In such cases, Vite replaces relative paths starting with `__VITE_ASSET__` using the URL retrieved from `document.currentScript`. However, this implementation is vulnerable to a DOM Clobbering attack. The `document.currentScript` lookup can be shadowed by an attacker via the browser's named DOM tree element access mechanism. This manipulation allows an attacker to replace the intended script element with a malicious HTML element. When this happens, the src attribute of the attacker-controlled element is used as the URL for importing scripts, potentially leading to the dynamic loading of scripts from an attacker-controlled server. This vulnerability can result in cross-site scripting (XSS) attacks on websites that include Vite-bundled files (configured with an output format of `cjs`, `iife`, or `umd`) and allow users to inject certain scriptless HTML tags without properly sanitizing the name or id attributes. This issue has been patched in versions 5.4.6, 5.3.6, 5.2.14, 4.5.5, and 3.2.11. Users are advised to upgrade. There are no known workarounds for this vulnerability.","ecosystems":["npm"],"exploits":{"exploitdb":0,"first_seen":null,"github_poc":0,"max_poc_stars":null,"metasploit":0,"nuclei":0,"refs":[],"tier":"weaponised"},"has_fix":true,"headline":"DOM Clobbering gadget found in vite bundled scripts that leads to XSS in Vite","id":"CVE-2024-45812","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":"npm","product":null,"products":[],"type":"xss","year":"2024"},"n_packages":12,"n_references":5,"next":{"headline":"ReDoS vulnerability in multiparametric routes in find-my-way","id":"CVE-2024-45813"},"packages":[{"ecosystem":"npm","fixed":["3.2.11"],"introduced":["0"],"last_affected":[],"package":"vite","purl":null,"source":"GHSA-64vr-g452-qvp3"},{"ecosystem":"npm","fixed":["3.2.11"],"introduced":["0"],"last_affected":[],"package":"vite","purl":"pkg:npm/vite","source":"GHSA-64vr-g452-qvp3"},{"ecosystem":"npm","fixed":["4.5.4"],"introduced":["4.0.0"],"last_affected":[],"package":"vite","purl":null,"source":"GHSA-64vr-g452-qvp3"},{"ecosystem":"npm","fixed":["4.5.4"],"introduced":["4.0.0"],"last_affected":[],"package":"vite","purl":"pkg:npm/vite","source":"GHSA-64vr-g452-qvp3"},{"ecosystem":"npm","fixed":["5.1.8"],"introduced":["5.0.0"],"last_affected":[],"package":"vite","purl":null,"source":"GHSA-64vr-g452-qvp3"},{"ecosystem":"npm","fixed":["5.1.8"],"introduced":["5.0.0"],"last_affected":[],"package":"vite","purl":"pkg:npm/vite","source":"GHSA-64vr-g452-qvp3"},{"ecosystem":"npm","fixed":["5.2.14"],"introduced":["5.2.0"],"last_affected":[],"package":"vite","purl":null,"source":"GHSA-64vr-g452-qvp3"},{"ecosystem":"npm","fixed":["5.2.14"],"introduced":["5.2.0"],"last_affected":[],"package":"vite","purl":"pkg:npm/vite","source":"GHSA-64vr-g452-qvp3"},{"ecosystem":"npm","fixed":["5.3.6"],"introduced":["5.3.0"],"last_affected":[],"package":"vite","purl":null,"source":"GHSA-64vr-g452-qvp3"},{"ecosystem":"npm","fixed":["5.3.6"],"introduced":["5.3.0"],"last_affected":[],"package":"vite","purl":"pkg:npm/vite","source":"GHSA-64vr-g452-qvp3"},{"ecosystem":"npm","fixed":["5.4.6"],"introduced":["5.4.0"],"last_affected":[],"package":"vite","purl":null,"source":"GHSA-64vr-g452-qvp3"},{"ecosystem":"npm","fixed":["5.4.6"],"introduced":["5.4.0"],"last_affected":[],"package":"vite","purl":"pkg:npm/vite","source":"GHSA-64vr-g452-qvp3"}],"prev":{"headline":"server.fs.deny bypassed when using ?import\u0026raw in vite","id":"CVE-2024-45811"},"products":["vite"],"published":"2024-09-17","related":[],"sources":[{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"}],"ssvc":{"automatable":"no","exploitation":"poc","technical_impact":"partial"},"state":"PUBLISHED","updated":"2024-09-18","vendors":["vitejs"]},"summary":"Attackers can execute arbitrary JavaScript via DOM clobbering in Vite-bundled scripts using specific output formats, requiring upgrade.","url":"https://insights.sbomify.com/CVE-2024-45812/"}