CVE-2026-27977: CWE-1385: Missing Origin Validation in WebSockets in vercel next.js
Next.js is a React framework for building full-stack web applications. Starting in version 16.0.1 and prior to version 16.1.7, in `next dev`, cross-site protection for internal websocket endpoints could treat `Origin: null` as a bypass case even if `allowedDevOrigins` is configured, allowing privacy-sensitive/opaque contexts (for example sandboxed documents) to connect unexpectedly. If a dev server is reachable from attacker-controlled content, an attacker may be able to connect to the HMR websocket channel and interact with dev websocket traffic. This affects development mode only. Apps without a configured `allowedDevOrigins` still allow connections from any origin. The issue is fixed in version 16.1.7 by validating `Origin: null` through the same cross-site origin-allowance checks used for other origins. If upgrading is not immediately possible, do not expose `next dev` to untrusted networks and/or block websocket upgrades to `/_next/webpack-hmr` when `Origin` is `null` at the proxy.
AI Analysis
Technical Summary
Next.js, a popular React framework for building full-stack web applications, includes a development mode feature called 'next dev' that supports Hot Module Replacement (HMR) via WebSocket connections. In versions 16.0.1 through 16.1.6, a vulnerability (CVE-2026-27977) exists due to improper origin validation on these internal WebSocket endpoints. Specifically, when the Origin header is set to 'null'—a value common in privacy-sensitive or sandboxed browsing contexts—the server incorrectly treats this as a bypass of cross-site origin checks, even if the developer has configured 'allowedDevOrigins' to restrict connections. This flaw allows attacker-controlled web pages to establish WebSocket connections to the development server's HMR channel, potentially enabling them to observe or interfere with development-time WebSocket traffic. The vulnerability is confined to development mode and does not affect production builds. The fix, introduced in version 16.1.7, ensures that 'Origin: null' is subjected to the same origin-allowance checks as other origins, closing the bypass. Mitigation prior to upgrading involves not exposing the development server to untrusted networks and blocking WebSocket upgrade requests with 'Origin: null' at the network proxy level. No known active exploits have been reported, and the CVSS 4.0 base score is 2.3, indicating low severity due to the limited attack surface, requirement for user interaction, and lack of impact on production environments.
Potential Impact
The impact of this vulnerability is primarily limited to development environments using vulnerable versions of Next.js. If an attacker can reach the development server from a malicious web page, they may connect to the internal WebSocket endpoint used for HMR, potentially allowing them to observe or manipulate development-time WebSocket traffic. This could lead to leakage of sensitive development information or interference with the developer's workflow. However, since this only affects development mode and not production deployments, the risk to end-users and live applications is minimal. Organizations that expose their development servers to untrusted networks or allow remote access without proper controls are at higher risk. The vulnerability does not allow code execution or compromise of production data, limiting its overall impact. Nevertheless, it could facilitate reconnaissance or targeted attacks against developers or internal testing environments, which might be leveraged in broader attack campaigns.
Mitigation Recommendations
To mitigate this vulnerability, organizations should upgrade Next.js to version 16.1.7 or later, where the origin validation issue is fixed. Until upgrading is feasible, developers must ensure that the development server ('next dev') is not exposed to untrusted or public networks. Network-level controls should be implemented to block WebSocket upgrade requests to the '/_next/webpack-hmr' endpoint when the Origin header is 'null'. This can be done via reverse proxies or firewalls capable of inspecting WebSocket handshake headers. Additionally, developers should configure the 'allowedDevOrigins' setting carefully to restrict allowed origins and avoid default permissive configurations. Monitoring development environment access logs for suspicious WebSocket connection attempts can also help detect exploitation attempts. Finally, educating development teams about the risks of exposing dev servers externally and enforcing secure development environment practices will reduce exposure.
Affected Countries
United States, Germany, United Kingdom, Canada, Australia, France, Netherlands, Japan, South Korea, India
CVE-2026-27977: CWE-1385: Missing Origin Validation in WebSockets in vercel next.js
Description
Next.js is a React framework for building full-stack web applications. Starting in version 16.0.1 and prior to version 16.1.7, in `next dev`, cross-site protection for internal websocket endpoints could treat `Origin: null` as a bypass case even if `allowedDevOrigins` is configured, allowing privacy-sensitive/opaque contexts (for example sandboxed documents) to connect unexpectedly. If a dev server is reachable from attacker-controlled content, an attacker may be able to connect to the HMR websocket channel and interact with dev websocket traffic. This affects development mode only. Apps without a configured `allowedDevOrigins` still allow connections from any origin. The issue is fixed in version 16.1.7 by validating `Origin: null` through the same cross-site origin-allowance checks used for other origins. If upgrading is not immediately possible, do not expose `next dev` to untrusted networks and/or block websocket upgrades to `/_next/webpack-hmr` when `Origin` is `null` at the proxy.
AI-Powered Analysis
Technical Analysis
Next.js, a popular React framework for building full-stack web applications, includes a development mode feature called 'next dev' that supports Hot Module Replacement (HMR) via WebSocket connections. In versions 16.0.1 through 16.1.6, a vulnerability (CVE-2026-27977) exists due to improper origin validation on these internal WebSocket endpoints. Specifically, when the Origin header is set to 'null'—a value common in privacy-sensitive or sandboxed browsing contexts—the server incorrectly treats this as a bypass of cross-site origin checks, even if the developer has configured 'allowedDevOrigins' to restrict connections. This flaw allows attacker-controlled web pages to establish WebSocket connections to the development server's HMR channel, potentially enabling them to observe or interfere with development-time WebSocket traffic. The vulnerability is confined to development mode and does not affect production builds. The fix, introduced in version 16.1.7, ensures that 'Origin: null' is subjected to the same origin-allowance checks as other origins, closing the bypass. Mitigation prior to upgrading involves not exposing the development server to untrusted networks and blocking WebSocket upgrade requests with 'Origin: null' at the network proxy level. No known active exploits have been reported, and the CVSS 4.0 base score is 2.3, indicating low severity due to the limited attack surface, requirement for user interaction, and lack of impact on production environments.
Potential Impact
The impact of this vulnerability is primarily limited to development environments using vulnerable versions of Next.js. If an attacker can reach the development server from a malicious web page, they may connect to the internal WebSocket endpoint used for HMR, potentially allowing them to observe or manipulate development-time WebSocket traffic. This could lead to leakage of sensitive development information or interference with the developer's workflow. However, since this only affects development mode and not production deployments, the risk to end-users and live applications is minimal. Organizations that expose their development servers to untrusted networks or allow remote access without proper controls are at higher risk. The vulnerability does not allow code execution or compromise of production data, limiting its overall impact. Nevertheless, it could facilitate reconnaissance or targeted attacks against developers or internal testing environments, which might be leveraged in broader attack campaigns.
Mitigation Recommendations
To mitigate this vulnerability, organizations should upgrade Next.js to version 16.1.7 or later, where the origin validation issue is fixed. Until upgrading is feasible, developers must ensure that the development server ('next dev') is not exposed to untrusted or public networks. Network-level controls should be implemented to block WebSocket upgrade requests to the '/_next/webpack-hmr' endpoint when the Origin header is 'null'. This can be done via reverse proxies or firewalls capable of inspecting WebSocket handshake headers. Additionally, developers should configure the 'allowedDevOrigins' setting carefully to restrict allowed origins and avoid default permissive configurations. Monitoring development environment access logs for suspicious WebSocket connection attempts can also help detect exploitation attempts. Finally, educating development teams about the risks of exposing dev servers externally and enforcing secure development environment practices will reduce exposure.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-02-25T03:24:57.793Z
- Cvss Version
- 4.0
- State
- PUBLISHED
Threat ID: 69b9ee21771bdb1749ef1e13
Added to database: 3/18/2026, 12:13:21 AM
Last enriched: 3/18/2026, 12:27:53 AM
Last updated: 3/18/2026, 7:08:43 AM
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 in Console -> Billing 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.