Skip to content
FlawDB
Sign in
Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

CVE-2024-45812

MEDIUM 6.4EPSS 58%

DOM Clobbering gadget found in vite bundled scripts that leads to XSS in Vite

Also known as GHSA-64vr-g452-qvp3

Mitigation

  • Upgrade vite to one of 5.4.6, 5.3.6, 5.2.14, 4.5.4, 3.2.11, 5.1.8 (or later in the same release line).

Who should check

  • Projects that depend on npm package vite (>= 5.4.0, < 5.4.6)
  • Anyone running vitejs vite >= 5.4.0, < 5.4.6; >= 5.3.0, < 5.3.6; >= 5.0.0, < 5.2.14; >= 4.0.0, < 4.5.5; < 3.2.11

Vulnerability facts

Affected
vite >= 5.4.0, < 5.4.6
Fixed in
5.4.6, 5.3.6, 5.2.14, 4.5.4, 3.2.11, 5.1.8
Exploited in the wild
Not in CISA KEV
Public exploit / PoC
None known
Remote exploitation
Remote, login needed
CVSS
6.4 (v3.1, CNA)CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:HOpen in CVSS calculator
Show all 8 CVSS metrics
  • Attack vector: Network
  • Attack complexity: High
  • Privileges required: Low
  • User interaction: None
  • Scope: Unchanged
  • Confidentiality impact: Low
  • Integrity impact: Low
  • Availability impact: High
EPSS
0.91% chance of exploitation in 30 days (percentile 58, 2026-11-26)
CWE
CWE-79
Published
Modified

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.

Affected and fixed versions

Package / productAffectedFixedSource
npm vite>= 5.4.0, < 5.4.65.4.6, 5.3.6, 5.2.14, 4.5.4, 3.2.11, 5.1.8osv
vitejs vite>= 5.4.0, < 5.4.6; >= 5.3.0, < 5.3.6; >= 5.0.0, < 5.2.14; >= 4.0.0, < 4.5.5; < 3.2.11—cvelist

Check your systems with an agent

Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.

Check whether anything I run is affected by CVE-2024-45812. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2024-45812.md
Affected: vite >= 5.4.0, < 5.4.6
Fixed in: 5.4.6, 5.3.6, 5.2.14, 4.5.4, 3.2.11, 5.1.8

Steps:
1. Search this machine and project for vite (npm), vitejs vite: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.

References

FAQ

Is CVE-2024-45812 being exploited?

There is no confirmed exploitation: CVE-2024-45812 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.91% chance of exploitation in the next 30 days (as of 2026-11-26).

How serious is CVE-2024-45812?

Medium: CVSS 6.4 (v3.1, scored by CNA). Remote, login needed. The attack needs conditions outside the attacker's control, which makes it harder.

Which versions are affected by CVE-2024-45812?

vite >= 5.4.0, < 5.4.6.

Is there a fix for CVE-2024-45812?

Yes. Fixed in 5.4.6, 5.3.6, 5.2.14, 4.5.4, 3.2.11, 5.1.8. Upgrade vite to one of 5.4.6, 5.3.6, 5.2.14, 4.5.4, 3.2.11, 5.1.8 (or later in the same release line).

How do I check if I'm affected by CVE-2024-45812?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

Sponsors