DOM Clobbering Gadget found in rollup bundled scripts that leads to XSS (CVE-2024-47068)
Description
A DOM Clobbering vulnerability (CVE-2024-47068) exists in rollup bundled scripts when using import.meta.url with output formats cjs, umd, or iife. This vulnerability allows an attacker to manipulate document.currentScript by injecting scriptless HTML elements with a name attribute of 'currentScript', leading to cross-site scripting (XSS) by loading attacker-controlled scripts. The issue arises because rollup replaces import.meta.url with a URL derived from document.currentScript without verifying the element's tag name. A patch is available that adds type checking to ensure the element is a SCRIPT tag before using its src attribute. The vulnerability affects rollup versions >=2.56.3 and <4.22.4 and has a CVSS 3.1 score of 6.4 (medium severity).
CVSS v3.1
Score 6.4medium
Affected software
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
Technical Analysis
The vulnerability is a DOM Clobbering gadget in rollup's bundled scripts when using import.meta.url in cjs, umd, or iife output formats. Rollup replaces import.meta.url with a URL derived from document.currentScript.src, but this lookup can be shadowed by an attacker via named DOM elements (e.g., an img tag with name='currentScript'). This allows an attacker to control the URL used for script loading, enabling XSS. The vulnerability is demonstrated by injecting an img tag with name='currentScript' and a malicious src, causing the page to load scripts from an attacker-controlled server. The issue is mitigated by patching rollup to verify that document.currentScript is a SCRIPT element before using its src attribute.
Potential Impact
This vulnerability can lead to cross-site scripting (XSS) attacks on websites that include rollup-bundled scripts configured with cjs, umd, or iife output formats and use import.meta.url, if those websites allow injection of scriptless HTML elements with unsanitized name or id attributes. Exploitation enables attackers to load and execute arbitrary scripts from attacker-controlled domains, potentially compromising the confidentiality, integrity, and availability of affected web applications.
Mitigation Recommendations
A patch is available for rollup that adds type checking to ensure document.currentScript is a SCRIPT element before using its src attribute, preventing DOM Clobbering attacks. Users should upgrade rollup to a fixed version >=4.22.4. Until patched, avoid allowing untrusted user input to inject HTML elements with name or id attributes that could shadow document.currentScript. Follow the vendor advisory for the official fix and update instructions.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- BREW-rollup-CVE-2024-47068
- Osv Schema Version
- 1.7.3
- Ecosystems
- ["Homebrew"]
- Cvss Version
- 3.1
Threat ID: 6ac2458012601ec6a3164066
Added to database: 10/04/2026, 12:24:32 UTC
Last enriched: 10/04/2026, 12:28:55 UTC
Last updated: 10/04/2026, 16:08:31 UTC
Views: 1
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
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
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.