CVE-2024-43788 DOM Clobbering Gadget found in Webpack's AutoPublicPathRuntimeModule that leads to Cross-site Scripting (XSS)

Medium 6.4 Published Updated

An attacker can execute arbitrary JavaScript via DOM clobbering in Webpack-generated code if user-controlled HTML is present.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2024-43788?

CVE-2024-43788 is a medium-severity cross-site scripting vulnerability in webpack, published on 27 Aug 2024. Any signed-in user can exploit it over the network, with no action from the victim.

Official description

Webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable of transforming, bundling, or packaging just about any resource or asset. The webpack developers have discovered a DOM Clobbering vulnerability in Webpack’s `AutoPublicPathRuntimeModule`. 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. Real-world exploitation of this gadget has been observed in the Canvas LMS which allows a XSS attack to happen through a javascript code compiled by Webpack (the vulnerable part is from Webpack). 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. This vulnerability can lead to cross-site scripting (XSS) on websites that include Webpack-generated files and allow users to inject certain scriptless HTML tags with improperly sanitized name or id attributes. This issue has been addressed in release version 5.94.0. All users are advised to upgrade. There are no known workarounds for this issue.

Weakness: CWE-79

Which versions are affected by CVE-2024-43788?

2 open source packages ship an affected version, including webpack. It affects 1 product.

PackageAffectedFixed in
webpack npmFrom 5.0.0-alpha.05.94.0
webpack npmFrom 5.0.0-alpha.05.94.0
Linux distribution packages (2)
forgejo openSUSE:TumbleweedAll versions8.0.3-1.1
rollup openSUSE:TumbleweedAll versions3.29.5-1.1

Products include Webpack.js Webpack.

How do I fix CVE-2024-43788?

Upgrade webpack to 5.94.0 or later.

Escape output for the context it lands in and set a strict Content Security Policy. Upgrading the affected component is the real fix. More about Cross-site scripting.

Is CVE-2024-43788 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-43788 exists.

Public exploit code: 1 proofs of concept on GitHub.

Sources

Also known as AZL-48365, CLSA-2026-1775089642, CLSA-2026-1775089643, DEBIAN-CVE-2024-43788, GHSA-4vvj-4cpr-p986, MINI-rrq4-6v4h-4rq9 and 4 more.

Is CVE-2024-43788 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free