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

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

- **Severity:** Medium 6.4 (`CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 27 Aug 2024
- **Updated:** 9 Jan 2025
- **Also known as:** AZL-48365, CLSA-2026-1775089642, CLSA-2026-1775089643, DEBIAN-CVE-2024-43788, GHSA-4vvj-4cpr-p986, MINI-rrq4-6v4h-4rq9, ROOT-APP-NPM-CVE-2024-43788, UBUNTU-CVE-2024-43788, openSUSE-SU-2024:14330-1, openSUSE-SU-2025:15020-1

## 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 (Improper Neutralization of Input During Web Page Generation)

## Which versions are affected by CVE-2024-43788?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `webpack` | npm | From 5.0.0-alpha.0 | 5.94.0 |
| `webpack` | npm | From 5.0.0-alpha.0 | 5.94.0 |
| `forgejo` | openSUSE:Tumbleweed | All versions | 8.0.3-1.1 |
| `rollup` | openSUSE:Tumbleweed | All versions | 3.29.5-1.1 |

Products: Webpack.js Webpack.

## How do I fix CVE-2024-43788?

Upgrade webpack to 5.94.0 or later.

## 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:

- https://github.com/batzionb/webpack-cve-2024-43788 (github_poc): https://github.com/batzionb/webpack-cve-2024-43788

## Other vulnerabilities in webpack

- [CVE-2023-28154](https://insights.sbomify.com/CVE-2023-28154/): Cross-realm object access in Webpack 5 (critical 9.8)
- [CVE-2025-68157](https://insights.sbomify.com/CVE-2025-68157/): webpack buildHttp HttpUriPlugin allowedUris bypass via HTTP redirects (low 3.7)
- [CVE-2025-68458](https://insights.sbomify.com/CVE-2025-68458/): webpack buildHttp: allowedUris allow-list bypass via URL userinfo (@) leading to build-time SSRF behavior (low 3.7)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-43788 and fix it if it is affected.

What it is: 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.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-43788 exists.

Affected packages and fixed versions:
- webpack (npm): affected from 5.0.0-alpha.0; fixed in 5.94.0
- webpack (npm): affected from 5.0.0-alpha.0; fixed in 5.94.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-43788/ (Markdown: https://insights.sbomify.com/CVE-2024-43788/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-43788
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-43788
- OSV: https://osv.dev/vulnerability/CVE-2024-43788

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-43788/
Summaries are generated and may contain mistakes; the official description above is the record.
