CVE-2026-6402: Webpack dev server Remote Code Execution Vulnerability
MODERATECVE-2026-6402 is a MODERATE (CVSS 5.3) remote code execution vulnerability (CWE-749: Exposed Dangerous Method or Function) affecting Webpack dev server libraries in the npm ecosystem. The issue involves webpack-dev-server vulnerable to cross-origin source code exposure on non-https origins. Remediation is available by upgrading affected packages to version 5.2.4.
CVE-2026-6402 at a Glance
Security Impact
CVSS: 5.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N).
How to Fix CVE-2026-6402
To remediate this vulnerability, upgrade all affected Webpack dev server dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install webpack-dev-server@5.2.4
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls webpack-dev-server
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2026-6402, inspect your project dependencies using npm:
npm ls webpack-dev-server
Analyze the terminal output to locate any version of Webpack dev server in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.2.4), your application is affected.
Note: The npm ls webpack-dev-server command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-749: Exposed Dangerous Method or Function, where the product provides an applications programming interface (api) or similar interface for interaction with external actors, but the interface includes a dangerous method or function that is not properly restricted. In Webpack dev server, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-6402 Affected Webpack dev server Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
webpack-dev-server
|
npm |
< 5.2.4
|
5.2.4
|
References
Frequently Asked Questions
What is CVE-2026-6402?
Which Webpack dev server versions are affected?
What version fixes CVE-2026-6402?
Is webpack-dev-server affected?
What is the CVSS score of CVE-2026-6402?
What CWE is associated with CVE-2026-6402?
How can I check npm dependencies for CVE-2026-6402?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-79cf-xcqc-c78w",
"modified" : "2026-05-18T13:31:42Z",
"published" : "2026-05-18T13:31:42Z",
"aliases" : [ "CVE-2026-6402" ],
"summary" : "webpack-dev-server vulnerable to cross-origin source code exposure on non-HTTPS origins",
"details" : "### Impact\n\nWhen webpack-dev-server is running on a non-HTTPS origin (the default), cross-origin requests from malicious websites can load the dev server's JavaScript bundles via `<script>` tags. The fix introduced in v5.2.1 (CVE-2025-30359) relied on `Sec-Fetch-Mode` and `Sec-Fetch-Site` request headers to block these requests, but browsers only send these headers for [potentially trustworthy origins](https://w3c.github.io/webappsec-secure-contexts/#is-origin-trustworthy). Over plain HTTP, the headers are absent and the check is bypassed.\n\nAn attacker who knows the dev server's host, port, and output path can exfiltrate all module source code by intercepting the webpack runtime's module registration.\n\nThis does not affect Chrome 142+ (and other Chromium-based browsers) due to [local network access restrictions](https://developer.chrome.com/release-notes/142#local_network_access_restrictions).\n\n### Patches\n\nPatched in webpack-dev-server >= 5.2.4 by setting `Cross-Origin-Resource-Policy: same-origin` on responses.\n\n### Workarounds\n\nRun the dev server with HTTPS enabled (`--https` or `server.type: 'https'` in config).\n\n### Resources\n\n- [GHSA-4v9v-hfq4-rm2v](https://github.com/webpack/webpack-dev-server/security/advisories/GHSA-4v9v-hfq4-rm2v) (CVE-2025-30359) - original vulnerability\n- [GHSA-9jgg-88mc-972h](https://github.com/webpack/webpack-dev-server/security/advisories/GHSA-9jgg-88mc-972h) (CVE-2025-30360) - prior bypass",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "webpack-dev-server"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "5.2.4"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 5.2.3"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/webpack/webpack-dev-server/security/advisories/GHSA-4v9v-hfq4-rm2v"
}, {
"type" : "WEB",
"url" : "https://github.com/webpack/webpack-dev-server/security/advisories/GHSA-79cf-xcqc-c78w"
}, {
"type" : "WEB",
"url" : "https://github.com/webpack/webpack-dev-server/security/advisories/GHSA-9jgg-88mc-972h"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-6402"
}, {
"type" : "WEB",
"url" : "https://cna.openjsf.org/security-advisories.html"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/webpack/webpack-dev-server"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-749" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-05-18T13:31:42Z",
"nvd_published_at" : "2026-05-12T09:16:55Z"
}
}