Skip to main content
EPSS 0.6%top 52%

Vite DOM Clobbering gadget found in vite bundled scripts that leads to XSS (CVE-2024-45812)

0
Medium
Published: 08/13/2026 (08/13/2026, 17:48:54 UTC)
Source: GCVE Database
Product: vite

Description

A DOM Clobbering vulnerability (CVE-2024-45812) exists in Vite when building scripts with output formats cjs, iife, or umd. This flaw allows an attacker to manipulate the document.currentScript property via a named HTML element, causing the dynamic import of scripts from attacker-controlled URLs. This can lead to cross-site scripting (XSS) in web pages that include Vite-bundled scripts and allow injection of scriptless attacker-controlled HTML elements. The vulnerability affects Vite versions from 2.5.1 up to but not including 5.4.6. A patch is available to address this issue.

CVSS v3.1

Score 6.4medium

Attack Vector
Network
Attack Complexity
High
Privileges Required
Low
User Interaction
None
Scope
Unchanged
Confidentiality
Low
Integrity
Low
Availability
High
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:H

Affected software

Homebrewmore threats →ghsa
vite
pkg:brew/vite
Affected versions
>=2.5.1 <5.4.6

Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 09/29/2026, 04:55:01 UTC

Technical Analysis

Vite's bundling process for cjs, iife, and umd output formats replaces relative asset paths using the URL from document.currentScript. However, document.currentScript can be shadowed by an attacker-controlled HTML element named 'currentScript', enabling the attacker to control the script URL used for dynamic imports. This DOM Clobbering gadget can be exploited by injecting scriptless HTML elements (e.g., an img tag with name='currentScript') into the page, leading to loading malicious scripts from attacker-controlled servers and resulting in cross-site scripting (XSS). The vulnerability is demonstrated with a proof-of-concept where an attacker injects an img element named 'currentScript' to hijack script loading.

Potential Impact

Successful exploitation allows an attacker to execute arbitrary scripts in the context of the vulnerable web page, resulting in cross-site scripting (XSS). This can lead to data theft, session hijacking, or other malicious actions depending on the attacker's payload. The impact is limited to web pages that include Vite-bundled scripts configured with the vulnerable output formats and that allow injection of scriptless attacker-controlled HTML elements.

Mitigation Recommendations

A patch is available for this vulnerability. Users should upgrade Vite to a fixed version at or above 5.4.6. Until patched, avoid using the cjs, iife, or umd output formats if possible, and ensure that user input is properly sanitized to prevent injection of attacker-controlled HTML elements with names that could shadow document.currentScript. Review the vendor advisory for detailed patch and mitigation instructions.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Gcve Source
db.gcve.eu
Osv Id
BREW-vite-CVE-2024-45812
Osv Schema Version
1.7.3
Ecosystems
["Homebrew"]
Cvss Version
3.1

Threat ID: 6abb419cf7a7c54106cc387a

Added to database: 09/29/2026, 04:42:04 UTC

Last enriched: 09/29/2026, 04:55:01 UTC

Last updated: 09/29/2026, 18:11:13 UTC

Views: 4

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need more coverage?

Upgrade to Pro Console for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses