Skip to content
Fencer Vulns
medium 6.4

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

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-rhel8
    affected: workaround, no fix available
  • Red Hat OpenShift distributed tracing 3.4 rhosdt
    fixed: 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 rhosdt
    not 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

Sources

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.