CVE-2026-76844: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in webpack webpack-dev-middleware
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.
AI Analysis
Technical Summary
The vulnerability arises because webpack-dev-middleware's pathname traversal guard only matches ".." as a whole path segment and slices the pathname at a fixed offset based on the publicPath length. When publicPath lacks a trailing slash, crafted requests like GET /assets../.env can bypass the guard, resulting in path.join resolving to a directory above the intended outputPath. This allows reading files outside the restricted directory if the middleware uses the physical filesystem backing (e.g., writeToDisk=true). The traversal depth is limited to one directory due to URL parsing collapsing dot-dot segments. This vulnerability is present in versions from 5.3.4, 6.1.2, and 7.1.0 onward and represents an incomplete fix of CVE-2024-29180.
Potential Impact
An attacker can read files outside the intended directory served by webpack-dev-middleware if the middleware is configured to write to disk or uses a custom outputFileSystem backed by the physical filesystem. This can lead to unauthorized disclosure of sensitive files on the server. The vulnerability does not allow code execution or privilege escalation but poses a high confidentiality impact due to potential exposure of sensitive data.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. Until a fix is available, avoid configuring webpack-dev-middleware with a publicPath that lacks a trailing slash and avoid enabling writeToDisk or using a physical filesystem backing if possible. Monitor vendor advisories for updates and apply official patches once released.
CVE-2026-76844: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in webpack webpack-dev-middleware
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.
CVSS v4.0
Score 8.3high
Affected software
pkg:npm/webpack-dev-middlewareRun 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 arises because webpack-dev-middleware's pathname traversal guard only matches ".." as a whole path segment and slices the pathname at a fixed offset based on the publicPath length. When publicPath lacks a trailing slash, crafted requests like GET /assets../.env can bypass the guard, resulting in path.join resolving to a directory above the intended outputPath. This allows reading files outside the restricted directory if the middleware uses the physical filesystem backing (e.g., writeToDisk=true). The traversal depth is limited to one directory due to URL parsing collapsing dot-dot segments. This vulnerability is present in versions from 5.3.4, 6.1.2, and 7.1.0 onward and represents an incomplete fix of CVE-2024-29180.
Potential Impact
An attacker can read files outside the intended directory served by webpack-dev-middleware if the middleware is configured to write to disk or uses a custom outputFileSystem backed by the physical filesystem. This can lead to unauthorized disclosure of sensitive files on the server. The vulnerability does not allow code execution or privilege escalation but poses a high confidentiality impact due to potential exposure of sensitive data.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. Until a fix is available, avoid configuring webpack-dev-middleware with a publicPath that lacks a trailing slash and avoid enabling writeToDisk or using a physical filesystem backing if possible. Monitor vendor advisories for updates and apply official patches once released.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- VulnCheck
- Date Reserved
- 2026-08-19T20:34:19.724Z
- Cvss Version
- 4.0
- State
- PUBLISHED
- Remediation Level
- null
Threat ID: 6a8c45b3acd9273b49946349
Added to database: 08/24/2026, 13:22:59 UTC
Last enriched: 08/24/2026, 13:37:26 UTC
Last updated: 08/24/2026, 21:06:44 UTC
Views: 8
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.