CVE-2024-45812 json
DOM Clobbering gadget found in vite bundled scripts that leads to XSS in Vite
published 2024-09-17 2 y ago modified 2026-09-10 1 mo ago also EUVD-2024-2728 , GHSA-64vr-g452-qvp3
- cvss
- 6.4
- version 3.1, CNA
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 0.6%
- EPSS 0.6% chance of exploitation in 30 days, percentile 50%
- public exploits
- 0
- none known
Summary
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.
Patch / fix
- npm vite 3.2.11, 4.5.4, 5.1.8, 5.2.14, 5.3.6, 5.4.6
- vitejs vite 3.2.11, 4.5.5, 5.2.14, 5.3.6, 5.4.6
- velociraptor openSUSE Tumbleweed 0.7.0.4.git142.862ef23-1.1
opensuse advisories openSUSE-SU-2025:14663-1
- github.com/vitejs/vite@ade1d89 commit
- github.com/vitejs/vite@179b177 commit
- github.com/vitejs/vite@2691bb3 commit
- github.com/vitejs/vite@2ddd854 commit
- github.com/vitejs/vite@e812716 commit
- github.com/vitejs/vite@ebb94c5 commit
Vendor advisories
What the vendors themselves say about their products: affected, fixed or not affected, and what to do.
red hat product security vex CVE-2024-45812 updated cvss 6.4
vite: XSS via DOM Clobbering gadget found in vite bundled scripts
-
Red Hat Ansible Automation Platform 2 automation-controller Red Hat OpenShift distributed tracing 3 rhosdt/tempo-jaeger-query-rhel8affected: workaround, no fix available
-
Red Hat OpenShift distributed tracing 3.4 rhosdtfixed: vendor fix RHSA-2024:10917
-
Red Hat Ansible Automation Platform 2 automation-eda-controller Red Hat JBoss Enterprise Application Platform 8 vite Red Hat OpenShift distributed tracing 3 rhosdt/jaeger-agent-rhel8, rhosdt/jaeger-ingester-rhel8, rhosdt/jaeger-collector-rhel8, rhosdt/jaeger-es-rollover-rhel8, rhosdt/jaeger-es-index-cleaner-rhel8 Red Hat OpenShift distributed tracing 3.4 rhosdtnot affected: vulnerable code not present
Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf
CISA SSVC
- Exploitation
- Proof of concept is public
- Automatable
- no
- Technical impact
- partial
- Assessed
- 2 y ago
Exploit prediction
0.64% chance of exploitation in the next 30 days, higher than 50% of all scored CVEs (FIRST EPSS, 2026-11-08).
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| CNA | 3.1 | 6.4 | CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:H |
| GitHub | 3.1 | 6.4 | CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:H |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| npm | vite | >=5.4.0, <5.4.6 >=5.3.0, <5.3.6 >=5.2.0, <5.2.14 >=4.0.0, <4.5.4 <3.2.11 >=5.0.0, <5.1.8 |
5.4.6 5.3.6 5.2.14 4.5.4 3.2.11 5.1.8 |
Affected products
- vitejs vite
Classification
- Weakness
-
- CWE-79 Improper Neutralization of Input During Web Page Generation
References
-
github.com
/vitejs/vite/commit/ade1d89660e17eedfd35652165b0c26905259fad
web
-
github.com
/vitejs/vite/commit/179b17773cf35c73ddb041f9e6c703fd9f3126af
web
-
github.com
/vitejs/vite/commit/2691bb3ff6b073b41fb9046909e1e03a74e36675
web
-
github.com
/vitejs/vite/commit/2ddd8541ec3b2d2e5b698749e0f2362ef28056bd
web
-
github.com
/vitejs/vite/commit/e8127166979e7ace6eeaa2c3b733c8994caa31f3
web
-
github.com
/vitejs/vite/commit/ebb94c5b3bf41950f45562595adec117a4d0ba5e
web
-
github.com
/vitejs/vite/security/advisories/GHSA-64vr-g452-qvp3
web
-
github.com
/webpack/webpack/security/advisories/GHSA-4vvj-4cpr-p986
web
-
research.securitum.com
/xss-in-amp4email-dom-clobbering
web
-
scnps.co
/papers/sp23_domclob.pdf
web
-
nvd.nist.gov
/vuln/detail/CVE-2024-45812
advisory
-
github.com
/vitejs/vite
package
Sources
- CVE List CVE-2024-45812
- GitHub Advisory GHSA-64vr-g452-qvp3
- NVD CVE-2024-45812
Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.
CPEs and fixed versions use Anchore's correction of NVD's data: Added CPE configurations because not yet analyzed by NVD.