CVE-2026-9595: webpack-dev-server HMR WebSocket Leaks Developer Credentials via Overly Broad Proxy Context
webpack-dev-server's Hot Module Replacement (HMR) feature can be inadvertently exposed to a user-configured proxy when the proxy context is set broadly (such as /). If WebSocket forwarding is enabled on that proxy, the dev server mistakenly routes its internal HMR WebSocket through the proxy to a backend server. This causes sensitive data—browser cookies and the Origin header—to leak to that backend, circumvents the dev server's built-in Host/Origin protections, and corrupts the HMR socket since both HMR and the proxy write to the same connection. The flaw affects webpack-dev-server versions before 5.2.5.
Source data · NVD / CISA · public domain
- CVSS
- 3.1 · 5.3 MEDIUM · CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
- Weaknesses (CWE)
- CWE-346, CWE-441
- Affected products
- 1 configuration(s)
- Published / Modified
- 2026-06-15 / 2026-06-17
NVD description (verbatim)
Impact: When a user-configured proxy on webpack-dev-server has a broad context (e.g. /) and ws: true, it also intercepts the dev server's own HMR WebSocket and forwards it to the proxy target. This leaks the browser's cookies and Origin header to the backend, bypasses the dev server's Host/Origin validation, and corrupts the HMR socket (both HMR and the proxy end up writing to the same socket). Patches: Fixed in [email protected]. Workarounds: Scope user-defined proxy context to specific paths instead of /, or omit ws: true from the proxy entry when WebSocket forwarding is not required.
5 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
When webpack-dev-server is configured with a user-defined proxy rule that has a broad context path (/) and ws: true for WebSocket support, the proxy middleware incorrectly intercepts the dev server's internal HMR WebSocket connection. The HMR socket, intended for local development communication between the client and dev server, gets forwarded through the proxy chain to the backend target. This dual-write scenario on a single socket corrupts both streams. Additionally, cookies and the Origin header present in the browser's WebSocket upgrade request are forwarded to the proxy backend, and the dev server's Host/Origin validation is bypassed because the proxy acts as an intermediary. The vulnerability is rooted in insufficient path scope validation when WebSocket forwarding is enabled (CWE-346: Origin Validation Error, CWE-441: Unintended Proxy or Intermediary).
Business impact
In a development environment, this vulnerability exposes sensitive authentication tokens and session cookies to a backend server that may be controlled or monitored by an attacker. For development teams using webpack-dev-server with proxy configurations—a common setup when integrating with microservices or backend APIs—the leak happens transparently without developer awareness. If the proxy target is compromised, the attacker gains access to the developer's credentials. Additionally, HMR corruption can degrade the development experience and mask the actual vulnerability. While this is a dev-time issue, if development and staging environments share similar proxy configurations, the risk escalates. The CVSS score of 5.3 (Medium) reflects limited availability impact (HMR corruption) but acknowledges confidentiality loss via credential leakage.
Affected systems
webpack-dev-server versions prior to 5.2.5 are affected. The vulnerability requires a specific configuration: a user-defined proxy with a broad context (e.g., /) and ws: true enabled. Developers using narrower proxy contexts (e.g., /api) or those without WebSocket forwarding enabled are not vulnerable. The issue is present in the proxy middleware's path-matching logic and only manifests when both conditions are met.
Exploitability
Exploitability requires the developer to have misconfigured webpack-dev-server with both a broad proxy context and WebSocket forwarding enabled—a plausible but not universal configuration. An attacker cannot remotely trigger this; they must either control or monitor the proxy backend to observe leaked credentials and Origin headers. No user interaction is required beyond the developer starting the dev server. The vulnerability is not actively tracked as an exploited vulnerability in the wild (KEV status: not listed). However, because many developers routinely set proxy context to / as a catch-all and may enable ws: true without careful consideration, the real-world exposure is moderate.
Remediation
Upgrade webpack-dev-server to version 5.2.5 or later. This release fixes the path scope validation to ensure HMR WebSocket connections are not intercepted by user-defined proxies. For teams unable to upgrade immediately, two workarounds are available: (1) Restrict the proxy context to specific paths (e.g., /api, /v1) instead of using /, preventing the dev server's HMR path from being matched; (2) Remove ws: true from the proxy configuration if WebSocket forwarding to the backend is not required. Verify your webpack-dev-server configuration file to confirm proxy settings align with your backend architecture.
Patch guidance
Update webpack-dev-server dependency to 5.2.5 or any later release. This version is available on npm. After upgrading, no configuration changes are required if you were relying on the broader proxy context—the fix ensures HMR is properly excluded from proxy interception. If your project uses a lock file (package-lock.json or yarn.lock), run npm install or yarn install to pull the patched version. Verify the dev server restarts cleanly and HMR functionality works as expected in your development workflow. For npm: npm install [email protected] or update your package.json and reinstall dependencies.
Detection guidance
Review your webpack.config.js or webpack configuration for proxy settings. Look for entries where context is set to / or other broad patterns (e.g., * or empty string) combined with ws: true. If found, examine proxy backend logs for unexpected WebSocket connections and unusual request headers (particularly Origin headers from your development machine). Monitor dev server logs for socket errors or HMR failures that might indicate the corruption described. In a corporate environment, inspect network traffic from developer machines to external proxy targets; unexpected cookies or authentication headers in WebSocket frames to a proxy backend may signal this misconfiguration. Automated scanning tools can flag webpack configs with broad proxy contexts and ws: true combinations.
Why prioritize this
Although the CVSS score is Medium (5.3), this vulnerability should be addressed promptly because it directly exposes developer credentials and authentication tokens. Developer machines often have elevated access or tokens to staging/production systems, making credential leakage a gateway to lateral movement. The fix is straightforward (a version bump), and the workarounds are simple configuration adjustments. The relative lack of widespread exploitation (not in KEV) suggests patching can proceed without emergency protocols, but should not be deprioritized. Teams with developers working on microservice architectures or those using proxy for local API development should prioritize this update.
Risk score, explained
CVSS 5.3 (Medium) is assigned due to the vulnerability being network-accessible (AV:N) with low attack complexity (AC:L) and no privileges or user interaction required (PR:N/UI:N). However, the scope remains unchanged (S:U), and there is no direct confidentiality or integrity impact to the dev server itself—the impact is availability (A:L) of HMR and leakage of the developer's client-side secrets (cookies/Origin). The scoring reflects that exploitation requires a specific misconfiguration and affects development environments rather than production systems. The real-world risk to organizations depends on how developers' credentials are used downstream and whether the proxy backend is under attacker control.
Frequently asked questions
Do I need to worry about this if I don't use a proxy in webpack-dev-server?
No. This vulnerability only manifests when a user-defined proxy is configured in webpack-dev-server with both a broad context (like /) and ws: true enabled. If you don't use proxies or your proxy context is narrowly scoped (e.g., /api), you are not affected.
Will upgrading to 5.2.5 break my existing proxy setup?
No. The fix ensures HMR is properly excluded from proxy interception. Your proxy will continue to function normally for backend API calls and other intended traffic. No configuration changes are required after upgrading, though reviewing your proxy context to follow best practices (specific paths instead of /) is recommended.
What exactly leaks when this vulnerability is exploited?
The browser's cookies and the Origin header from the WebSocket upgrade request are forwarded to the proxy backend target. If that backend is compromised or monitored by an attacker, they gain access to the developer's session tokens and authentication credentials stored in cookies.
If I can't upgrade immediately, which workaround is better—narrowing the proxy context or removing ws: true?
Narrow the proxy context to specific paths (e.g., /api) if your backend APIs require WebSocket support. Remove ws: true only if your backend does not need WebSocket forwarding at all. Narrowing context is generally preferred because it maintains functionality while fixing the scope issue.
This analysis is based on vulnerability disclosures and vendor advisories published as of the date indicated. Patch versions and remediation guidance should be verified against official webpack.js and webpack-dev-server project releases and security announcements. Organizations should conduct their own risk assessments based on their specific configurations and deployment environments. This vulnerability affects development environments; production impact depends on how developer credentials are used and protected in downstream systems. No proof-of-concept code or weaponized exploit details are provided. Always test patches in a non-production environment before broad deployment. Source: NVD (public-domain), retrieved 2026-07-24. Analysis generated by SEC.co (claude-haiku-4-5).
Related vulnerabilities
- CVE-2026-10010MEDIUMChrome Android Site Isolation Bypass
- CVE-2026-10937MEDIUMChrome Same-Origin Policy Bypass in Password Handling
- CVE-2026-10996MEDIUMChrome Same-Origin Policy Bypass in Web Workers
- CVE-2026-11020MEDIUMChrome Extension XML Cross-Origin Data Leak – Patch to 149.0.7827.53
- CVE-2026-11032MEDIUMChrome Password Manager Cross-Origin Data Leak
- CVE-2026-11036MEDIUMChrome Same-Origin Policy Bypass via DOM Implementation Flaw
- CVE-2026-11048MEDIUMChrome Extension Same-Origin Policy Bypass (Medium, 6.5)
- CVE-2026-11081MEDIUMChrome Canvas Same-Origin Policy Bypass