CVE-2024-29180
webpack-dev-middleware Path Traversal vulnerability
Check your servers for CVE-2024-29180
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2024-29180 affects webpack-dev-middleware, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
Description
Prior to versions 7.1.0, 6.1.2, and 5.3.4, the webpack-dev-middleware development middleware for devpack does not validate the supplied URL address sufficiently before returning the local file. It is possible to access any file on the developer's machine. The middleware can either work with the physical filesystem when reading the files or it can use a virtualized in-memory `memfs` filesystem. If `writeToDisk` configuration option is set to `true`, the physical filesystem is used. The `getFilenameFromUrl` method is used to parse URL and build the local file path. The public path prefix is stripped from the URL, and the `unsecaped` path suffix is appended to the `outputPath`. As the URL is not unescaped and normalized automatically before calling the midlleware, it is possible to use `%2e` and `%2f` sequences to perform path traversal attack.
Developers using `webpack-dev-server` or `webpack-dev-middleware` are affected by the issue. When the project is started, an attacker might access any file on the developer's machine and exfiltrate the content. If the development server is listening on a public IP address (or `0.0.0.0`), an attacker on the local network can access the local files without any interaction from the victim (direct connection to the port). If the server allows access from third-party domains, an attacker can send a malicious link to the victim. When visited, the client side script can connect to the local server and exfiltrate the local files. Starting with fixed versions 7.1.0, 6.1.2, and 5.3.4, the URL is unescaped and normalized before any further processing.
Severity (CVSS)
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:N
- Attack vector
- network: an attacker can reach the vulnerable part over the network, often from the internet
- Attack complexity
- low: an attack works without special conditions
- Privileges required
- none: the attacker does not need an account
- User interaction
- required: a user has to do something, such as open a link or a file
- Scope
- changed: the damage reaches other components, such as the host of a container or other users
- Impact
- confidentiality high, integrity none, availability none: what an attacker can read (confidentiality), change (integrity) or stop (availability)
Exploitation
EPSS 1.23%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 69.6% of all scored CVEs. Scores of 1 Dec 2026.
The assessment of CISA (SSVC, 2 Aug 2024):
- Exploitation
- poc: a proof of concept is public
- Automatable
- no: each attack takes manual steps
- Technical impact
- partial: limited control or limited data
Weakness
- CWE-22 Improper Limitation of a Pathname to a Restricted Directory
Affected products
As the CNA lists them.
| Product | Versions |
|---|---|
| webpack-dev-middleware |
affected >= 7.0.0, < 7.1.0 affected >= 6.0.0, < 6.1.2 affected < 5.3.4
|
Is my server affected?
Find the installed version of webpack-dev-middleware and compare it with the fixed version of your distribution. Distributions often fix a CVE in a package version of their own, so the version number of the upstream project can mislead.
Debian, Ubuntu
dpkg -l | grep -i webpack-dev-middleware
# packages whose changelog names the CVE (fixed in the installed version)
zgrep -l CVE-2024-29180 /usr/share/doc/*/changelog.Debian.gz
# Ubuntu
pro fix CVE-2024-29180RHEL, Rocky, Alma, Fedora
rpm -q webpack-dev-middleware
# lists the advisory while the fix is not installed
dnf updateinfo list --cve CVE-2024-29180Alpine
apk list --installed | grep -i webpack-dev-middlewareWith Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2024-29180
trivy image --scanners vuln IMAGE | grep CVE-2024-29180
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Advisories
- https://github.com/webpack/webpack-dev-middleware/security/advisories/GHSA-wr3j-pwj9-hqq6 github.com
Other references
- https://github.com/webpack/webpack-dev-middleware/commit/189c4ac7d2344ec132a4689e74dc837ec5be0132 github.com
- https://github.com/webpack/webpack-dev-middleware/commit/9670b3495da518fe667ff3428c5e4cb9f2f3d353 github.com
- https://github.com/webpack/webpack-dev-middleware/commit/e10008c762e4d5821ed6990348dabf0d4d93a10e github.com
- https://github.com/webpack/webpack-dev-middleware/blob/7ed24e0b9f53ad1562343f9f517f0f0ad2a70377/src/utils/getFilenameFromUrl.js#L82 github.com
- https://github.com/webpack/webpack-dev-middleware/blob/7ed24e0b9f53ad1562343f9f517f0f0ad2a70377/src/utils/setupOutputFileSystem.js#L21 github.com
- https://github.com/webpack/webpack-dev-middleware/releases/tag/v5.3.4 github.com
- https://github.com/webpack/webpack-dev-middleware/releases/tag/v6.1.2 github.com
- https://github.com/webpack/webpack-dev-middleware/releases/tag/v7.1.0 github.com
Source: the record CVE-2024-29180 of the CVE List (CVE Program), CVE Terms of Use; the CISA KEV catalog and the CISA ADP container; EPSS of FIRST; the CWE catalog of MITRE, CWE Terms of Use. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse