Description
webpack-dev-middleware resolves a request to a local file in getFilenameFromUrl by testing the request pathname against a traversal guard and then slicing it at a fixed character offset. The guard, UP_PATH_REGEXP applied to path.normalize(`./${pathname}`), only matches ".." that stands as a whole path segment, while the containment test is the string comparison pathname.startsWith(publicPathPathname) and the file path is built as path.join(outputPath, pathname.slice(publicPathPathname.length)). When the configured publicPath has no trailing slash, a request such as GET /assets../.env against publicPath /assets yields the pathname /assets../.env, whose only dot-dot sits inside the segment "assets.." and so passes the guard, but the offset slice cuts within that segment and hands "../.env" to path.join, resolving one directory above outputPath. Reading a file from that path requires the middleware to be backed by the physical filesystem, which happens when writeToDisk is true or a custom outputFileSystem is supplied, since the default memfs volume holds only build output. Traversal depth is limited to a single directory because a separately delimited dot-dot segment is collapsed during URL parsing before the guard runs. The default publicPath value of "auto" resolves to "/" and is not affected. This is an incomplete fix for CVE-2024-29180: the guard and offset slice were introduced by that fix and are present in every release from 5.3.4, 6.1.2 and 7.1.0 onward.
Published: 2026-08-24
Score: 8.3 High
EPSS: < 1% Very Low
KEV: No
Impact: Local file read via path traversal
Action: Immediate Patch
AI Analysis

Impact

The vulnerability allows an attacker to read arbitrary files on the host where the webpack-dev-middleware is running. It is a path traversal flaw triggered by requests that do not terminate the configured publicPath with a slash. The flaw originates from a guard that only blocks whole‑segment ".." patterns, while the offset slice used to construct the file path cuts into the untrusted segment. When the guard passes, the relative path is joined with the output directory, allowing the file system to resolve a directory one level above the intended build directory. The weakness is CWE‑22, exposing integrity and confidentiality of files without proper filters.

Affected Systems

Affected products are webpack’s webpack-dev-middleware, in all releases from 5.3.4 onward. The issue surfaces when the configured publicPath has no trailing slash and the middleware is backed by a physical file system – for example when writeToDisk is true or a custom outputFileSystem is supplied. The default publicPath value of "auto" resolves to "/" and is not affected, but any non‑trailing‑slash publicPath such as "/assets" can be abused.

Risk and Exploitability

The CVSS score of 8.3 indicates high severity, while the EPSS score is not available, so a precise probability cannot be stated. The vulnerability is not listed in CISA KEV. The likely attack vector is an HTTP GET request to the development server’s asset endpoint; the attacker merely needs network access to the dev server. Because the directory traversal is limited to a single level and requires that the middleware writes to or reads from disk, the risk is lower than a full system compromise but still enables reading sensitive files such as configuration or environment files. Since the bug can be triggered by a simple crafted URL, exploitation is straightforward for an attacker who can reach the dev server.

Generated by OpenCVE AI on August 24, 2026 at 17:15 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade webpack‑dev‑middleware to the latest patched version that resolves the path traversal issue.
  • Configure the publicPath to end with a trailing slash or use the default "auto" value so the offset slice bug is avoided.
  • If writeToDisk must remain true, restrict the output directory to a minimal set of files and run the dev server under the least privileged user.

Generated by OpenCVE AI on August 24, 2026 at 17:15 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Thu, 27 Aug 2026 18:00:00 +0000

Type Values Removed Values Added
References
Metrics threat_severity

None

threat_severity

Important


Wed, 26 Aug 2026 19:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'partial'}, 'version': '2.0.3'}


Mon, 24 Aug 2026 13:30:00 +0000

Type Values Removed Values Added
Description webpack-dev-middleware resolves a request to a local file in getFilenameFromUrl by testing the request pathname against a traversal guard and then slicing it at a fixed character offset. The guard, UP_PATH_REGEXP applied to path.normalize(`./${pathname}`), only matches ".." that stands as a whole path segment, while the containment test is the string comparison pathname.startsWith(publicPathPathname) and the file path is built as path.join(outputPath, pathname.slice(publicPathPathname.length)). When the configured publicPath has no trailing slash, a request such as GET /assets../.env against publicPath /assets yields the pathname /assets../.env, whose only dot-dot sits inside the segment "assets.." and so passes the guard, but the offset slice cuts within that segment and hands "../.env" to path.join, resolving one directory above outputPath. Reading a file from that path requires the middleware to be backed by the physical filesystem, which happens when writeToDisk is true or a custom outputFileSystem is supplied, since the default memfs volume holds only build output. Traversal depth is limited to a single directory because a separately delimited dot-dot segment is collapsed during URL parsing before the guard runs. The default publicPath value of "auto" resolves to "/" and is not affected. This is an incomplete fix for CVE-2024-29180: the guard and offset slice were introduced by that fix and are present in every release from 5.3.4, 6.1.2 and 7.1.0 onward.
Title webpack-dev-middleware Path Traversal via Offset Slice on a Non-Slash-Terminated publicPath
First Time appeared Webpack.js
Webpack.js webpack-dev-middleware
Weaknesses CWE-22
CPEs cpe:2.3:a:webpack.js:webpack-dev-middleware:*:*:*:*:*:*:*:*
Vendors & Products Webpack.js
Webpack.js webpack-dev-middleware
References
Metrics cvssV3_1

{'score': 7.4, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:N'}

cvssV4_0

{'score': 8.3, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:N/VA:N/SC:H/SI:N/SA:N'}


Subscriptions

Webpack.js Webpack-dev-middleware
cve-icon MITRE

Status: PUBLISHED

Assigner: VulnCheck

Published:

Updated: 2026-08-26T18:22:44.932Z

Reserved: 2026-08-19T20:34:19.724Z

Link: CVE-2026-76844

cve-icon Vulnrichment

Updated: 2026-08-26T18:22:40.939Z

cve-icon NVD

Status : Received

Published: 2026-08-24T14:17:02.250

Modified: 2026-08-26T19:17:05.053

Link: CVE-2026-76844

cve-icon Redhat

Severity : Important

Publid Date: 2026-08-24T13:12:01Z

Links: CVE-2026-76844 - Bugzilla

cve-icon OpenCVE Enrichment

Updated: 2026-08-24T17:30:06Z

Weaknesses
  • CWE-22

    Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')