CVE-2024-45812
Last modified
CVE-2024-45812 is a medium-severity vulnerability rated 6.4/10 on the CVSS scale. 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. EPSS estimates a 0.64% chance of exploitation in the next 30 days.
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.
Metrics
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:H
Weakness Enumeration
References
Timeline
- Published
- Last Modified
- Status
- Deferred
Frequently Asked Questions
What is CVE-2024-45812?
How severe is CVE-2024-45812?
How do I fix CVE-2024-45812?
How Strix Helps
- How Strix found a critical auth bypass in etcdStrix autonomously discovered a critical authentication bypass in etcd, later designated CVE-2026-33413.
- Autonomous PentestingAI agents that find and validate exploitable vulnerabilities like this one across your applications.
- PR ReviewsPentest every pull request so vulnerable code is caught before it ships to production.
- AI Penetration TestingHow AI-driven penetration testing continuously covers your attack surface.
Related CVEs from 2024
- CVE-2024-45807Envoy is a cloud-native high-performance edge/middle/service…7.5
- CVE-2024-45808Envoy is a cloud-native high-performance edge/middle/service…6.5
- CVE-2024-45809Envoy is a cloud-native high-performance edge/middle/service…7.5
- CVE-2024-4581The Slider Revolution plugin for WordPress is vulnerable to …5.4
- CVE-2024-45810Envoy is a cloud-native high-performance edge/middle/service…7.5
- CVE-2024-45811Vite a frontend build tooling framework for javascript. In a…4.8
- CVE-2024-45813find-my-way is a fast, open source HTTP router, internally u…5.3
- CVE-2024-45815Backstage is an open framework for building developer portal…6.5
- CVE-2024-45816Backstage is an open framework for building developer portal…6.5
- CVE-2024-45817In x86's APIC (Advanced Programmable Interrupt Controller) a…7.3
- CVE-2024-45818The hypervisor contains code to accelerate VGA memory access…6.5
- CVE-2024-45819PVH guests have their ACPI tables constructed by the toolsta…5.5
Are you affected by CVE-2024-45812?
Run a free Strix scan to check your systems for this vulnerability.
Scan your code nowSource: NVD / NIST
