#VU125302 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in Vite - CVE-2024-45812
Published: September 17, 2024 / Updated: April 8, 2026
Vite
Vite
Description
The vulnerability allows a remote user to execute arbitrary script code in the victim's browser.
The vulnerability exists due to improper control of dynamically resolved script URLs via DOM clobbering in vite bundled scripts when processing attacker-controlled scriptless HTML elements on a page that uses cjs, iife, or umd build output and dynamically imports scripts from the assets folder. A remote user can inject a crafted HTML element that shadows document.currentScript to execute arbitrary script code in the victim's browser.
The issue arises because the document.currentScript lookup can be shadowed through the browser's named DOM tree element access mechanism, causing an attacker-controlled element src value to be used for dynamic script loading.