The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2024-45812

CVE-2024-45812: Vite DOM Clobbering XSS Vulnerability

CVE-2024-45812 is a DOM Clobbering cross-site scripting vulnerability in Vite that affects scripts built to cjs/iife/umd formats. This article covers technical details, affected versions, security impact, and mitigation.

Updated: January 22, 2026

CVE-2024-45812 Overview

CVE-2024-45812 is a DOM Clobbering vulnerability affecting Vite, a popular frontend build tooling framework for JavaScript. This vulnerability can lead to Cross-Site Scripting (XSS) attacks when Vite-bundled scripts are configured to use cjs, iife, or umd output formats. The flaw allows attackers to inject seemingly benign HTML elements that can be leveraged to execute malicious scripts through code reuse techniques.

DOM Clobbering is a sophisticated attack where an attacker embeds non-script HTML markup (such as through user-generated content like posts or comments) and leverages existing JavaScript code patterns to transform this markup into executable code. In Vite's case, the vulnerability specifically targets the dynamic script import mechanism used when building to CommonJS, IIFE, or UMD formats.

Critical Impact

Attackers can achieve cross-site scripting (XSS) on websites using Vite-bundled files by exploiting the document.currentScript lookup mechanism, potentially allowing malicious script loading from attacker-controlled servers.

Affected Products

  • Vite versions prior to 5.4.6
  • Vite versions prior to 5.3.6
  • Vite versions prior to 5.2.14
  • Vite versions prior to 4.5.5
  • Vite versions prior to 3.2.11

Discovery Timeline

  • 2024-09-17 - CVE-2024-45812 published to NVD
  • 2024-09-20 - Last updated in NVD database

Technical Details for CVE-2024-45812

Vulnerability Analysis

The vulnerability exists in Vite's handling of dynamic script imports when building to cjs, iife, or umd output formats. During the build process, Vite replaces relative paths that start with __VITE_ASSET__ using the URL retrieved from document.currentScript. This mechanism is designed to resolve asset paths at runtime, but it introduces a significant security weakness.

The document.currentScript property can be manipulated through the browser's named DOM tree element access mechanism—a behavior that forms the foundation of DOM Clobbering attacks. When an attacker can inject HTML elements with specific name or id attributes into a page, these elements can shadow legitimate DOM properties and objects.

In this specific case, an attacker who can inject an HTML element (such as an <img> tag) with a name attribute matching currentScript can effectively replace the legitimate script reference. The bundled Vite code then retrieves the src attribute from the attacker-controlled element instead of the legitimate script element, enabling the dynamic loading of scripts from an attacker-controlled server.

Root Cause

The root cause is improper validation of the document.currentScript property before using it to construct URLs for dynamic script imports. Vite's bundled output code assumes that document.currentScript will always reference the legitimate script element, without accounting for the possibility that this property could be shadowed by DOM Clobbering techniques.

This represents a CWE-79 (Improper Neutralization of Input During Web Page Generation) vulnerability, as the application fails to properly handle the possibility of attacker-controlled HTML elements interfering with its script loading mechanism.

Attack Vector

The attack requires network access and exploits the following conditions:

  1. A website must include Vite-bundled JavaScript files configured with cjs, iife, or umd output format
  2. The website must allow users to inject certain scriptless HTML tags (e.g., <img>, <form>, <object>) without properly sanitizing the name or id attributes
  3. The attacker injects an HTML element with a name attribute set to currentScript
  4. When Vite's bundled code attempts to dynamically import assets, it retrieves the src from the attacker's element
  5. This causes the application to load and execute scripts from an attacker-controlled server

The attack is particularly effective because it does not require script injection directly—the attacker only needs to inject seemingly harmless HTML attributes that most sanitizers may overlook. For detailed technical analysis, see the Vite Security Advisory and the SCNPS research paper on DOM Clobbering.

Detection Methods for CVE-2024-45812

Indicators of Compromise

  • Unexpected HTML elements with name="currentScript" or similar DOM-clobbering attribute patterns in user-generated content
  • Network requests to external domains from pages using Vite-bundled scripts that should only load local assets
  • JavaScript errors related to document.currentScript returning unexpected values or objects
  • Evidence of script loading from domains not associated with the application's asset CDN

Detection Strategies

  • Implement Content Security Policy (CSP) monitoring to detect script loading from unauthorized domains
  • Deploy web application firewalls (WAF) with rules to detect suspicious name and id attributes in user input that could be used for DOM Clobbering
  • Monitor client-side JavaScript errors for anomalies in document.currentScript behavior
  • Conduct regular security scans of user-generated content for potential DOM Clobbering payloads

Monitoring Recommendations

  • Enable detailed logging for script loading failures and CSP violations
  • Set up alerts for network requests to unexpected external domains from web pages
  • Implement automated scanning of user input for HTML attributes that could enable DOM Clobbering attacks
  • Monitor for patterns consistent with XSS exploitation attempts following DOM Clobbering injection

How to Mitigate CVE-2024-45812

Immediate Actions Required

  • Upgrade Vite to patched versions: 5.4.6, 5.3.6, 5.2.14, 4.5.5, or 3.2.11 depending on your version branch
  • Review and enhance input sanitization to strip or encode name and id attributes from user-controlled HTML
  • Implement strict Content Security Policy (CSP) headers to restrict script sources
  • Audit existing user-generated content for potential DOM Clobbering payloads

Patch Information

Security patches have been released across all supported Vite version branches. The fix addresses the unsafe reliance on document.currentScript by implementing proper validation. Organizations should upgrade to the following minimum versions:

Version BranchPatched Version
5.4.x5.4.6
5.3.x5.3.6
5.2.x5.2.14
4.5.x4.5.5
3.2.x3.2.11

For detailed changes, see the GitHub commit.

Workarounds

  • According to the security advisory, there are no known workarounds for this vulnerability—upgrading is the only complete remediation
  • As a defense-in-depth measure, implement strict CSP headers with explicit script-src directives to limit script loading to trusted domains
  • Enhance HTML sanitization to remove or encode name and id attributes from user-generated content
  • Consider temporarily switching to ES module output format (es) if your application supports it, as this format is not affected
bash
# Update Vite to the latest patched version
npm update vite

# Or specify a minimum version in package.json
npm install vite@^5.4.6

# Verify the installed version
npm list vite

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeXSS

  • Vendor/TechVite

  • SeverityMEDIUM

  • CVSS Score6.4

  • EPSS Probability0.19%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:H
  • Impact Assessment
  • ConfidentialityHigh
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-79
  • Technical References
  • GitHub Commit Changes

  • GitHub Security Advisory

  • GitHub Security Advisory

  • Securitum XSS Analysis

  • SCNPS Research Paper
  • Related CVEs
  • CVE-2026-39364: Vite Information Disclosure Vulnerability

  • CVE-2026-39365: Vite Path Traversal Vulnerability

  • CVE-2026-39363: Vite Information Disclosure Vulnerability

  • CVE-2025-32395: Vite Information Disclosure Vulnerability
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English