Improper input validation in WebRTC (CVE-2026-79255)
A compromised renderer could call the network service's P2P socket interface directly to open TCP connections to restricted ports on internal addresses, bypassing the renderer-side port check. A parsing flaw in STUN framing kept the connection alive and let the attacker smuggle plain-text protocol commands, giving a cross-protocol SSRF against internal services.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 4 months
Project Fortify, an experimental security project, has identified the following potential security issue. If you're a feature owner CC-ed on this bug, please do your best to review these reports without the Chrome Security team. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.
Overview: A compromised renderer can bypass restricted port checks (e.g., for SMTP port 25) by calling network::mojom::P2PSocketManager::CreateSocket directly via Mojo, as the network process lacks sufficient port validation for non-loopback addresses. By using a STUN TCP socket, the attacker can leverage flaws in STUN packet parsing and framing to keep the connection alive and smuggle text-based protocol commands. This enables potential Cross-Protocol SSRF attacks against internal network services.
Affected files:
services/network/p2p/socket_manager.ccservices/network/p2p/socket_tcp.ccservices/network/p2p/socket.cc
Estimated timestamp from git blame: 2024-11-18
Summary
A vulnerability in P2PSocketManager::CreateSocket allows a compromised renderer process to bypass Blink's port restrictions and establish TCP connections to restricted ports (such as 25, 6667) on internal network addresses. Combined with shallow STUN packet validation and a parsing flaw in how the network service handles non-STUN server greetings, an attacker can maintain the connection and smuggle arbitrary text protocol commands, resulting in a Cross-Protocol Server-Side Request Forgery (SSRF).
Technical Details
1. Bypassing Port Restrictions via Mojo
Normally, when a WebRTC application attempts to connect to a restricted port (e.g., SMTP port 25), the connection is blocked in the renderer by IpcPacketSocketFactory::CreateClientTcpSocket using net::IsPortAllowedForScheme. However, a compromised renderer can bypass this check by directly obtaining the network::mojom::P2PSocketManager interface via the BrowserInterfaceBroker and calling CreateSocket.
In the network service, P2PSocketManager::CreateSocket (services/network/p2p/socket_manager.cc) validates the local port range but does not validate the remote_address against the restricted port list. It initializes a P2PSocketTcpBase which uses ProxyResolvingClientSocketFactory. The underlying TCPClientSocket only checks net::IsPortAllowedForIpEndpoint, which currently only blocks restricted ports on the loopback address (127.0.0.1), allowing connections to internal network IPs (e.g., 192.168.1.10:25).
2. Connection Teardown Bypass
When connecting to a text-based server like SMTP, the server sends a greeting (e.g., "220 smtp.example.com\r\n"). The network process processes this in P2PSocketStunTcp::ProcessInput, which calls GetExpectedPacketSize.
GetExpectedPacketSize incorrectly parses the ASCII string "220 " (hex 0x3232 0x3020). It treats 0x3232 as a STUN message type (top two bits are zero) and 0x3020 as a length of 12,320 bytes. Expecting a massive STUN packet, ProcessInput buffers the data indefinitely instead of passing it to OnPacket. Because OnPacket is never called, the check that would normally terminate the socket upon receiving non-STUN data is bypassed, keeping the TCP connection alive.
3. Protocol Smuggling
With the connection alive but formally "unconnected" in STUN state, outgoing packets must pass P2PSocket::GetStunPacketType. This function only validates the first 8 bytes (Type, Length, and Magic Cookie).
The attacker can craft a payload starting with a valid 8-byte STUN header, followed by a 12-byte Transaction ID and plain-text SMTP commands (e.g., \r\nHELO attacker.com\r\nMAIL FROM:...). Because P2PSocketStunTcp::DoSend writes the STUN packet directly to the TCP stream without an RFC 4571 length prefix, the SMTP server receives the raw bytes. It treats the 20-byte STUN header as an unrecognized command (often ignoring it without closing the connection) and successfully executes the subsequent smuggled commands.
Potential Steps to Reproduce
Note: Our tooling cannot execute code, so these are suggested steps based on static analysis.
- From a compromised renderer, use
BrowserInterfaceBrokerto requestnetwork::mojom::P2PSocketManager. - Call
CreateSocketwithtype=P2P_SOCKET_STUN_TCP_CLIENTandremote_addresspointing to an internal SMTP server (e.g.,192.168.1.10:25). - Wait for the
SocketCreatedMojo callback, confirming the TCP connection. - Send a crafted STUN packet via
P2PSocketClient. The packet must contain a valid 8-byte STUN header where the length field accurately accounts for the entire packet size, followed by the smuggled SMTP commands. - The network process will transmit the payload. The SMTP server will buffer the 20-byte STUN header, hit the newline, process it as an invalid command, and then process the smuggled commands.
Suggested Fix
Add a net::IsPortAllowedForScheme(remote_address.ip_address.port(), "stun") check within P2PSocketManager::CreateSocket (or deeper in P2PSocketTcpBase::Init / P2PSocketUdp::Init) in the network service to ensure that compromised renderers cannot request P2P connections to restricted ports on any IP address.
Evaluated with Chrome root at commit: eca8648a4e1cdfdda68c495a6003059fed641955
Results so far have been promising, but there can be wrong deductions. If this proves to be a false positive, please close as WAI; data from false positives will be used to improve accuracy over time. And please feel free to reach out to me directly if you have concerns or feedback on the project.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the network service's P2PSocketManager::CreateSocket does not apply the restricted-port check to the remote address, and the STUN TCP parser misreads non-STUN greetings as huge STUN packets, so the connection is never torn down.
Impact
An attacker who already controls the renderer could reach restricted ports on internal network addresses and smuggle text protocol commands, potentially performing cross-protocol SSRF against internal services; the report notes the steps are from static analysis and not executed.
What the attacker needed
Attacker already controls the renderer; internal service reachable from browser host
The fix
The network service should check the remote port against the restricted list for the STUN scheme inside P2PSocketManager::CreateSocket or the socket init code, so restricted ports are blocked on any IP address.
How it was found
- From a compromised renderer, request the P2PSocketManager interface through the BrowserInterfaceBroker.
- Call CreateSocket with a STUN TCP client type and a remote address pointing at an internal SMTP server.
- Wait for the SocketCreated callback confirming the TCP connection.
- Send a crafted STUN packet whose header length covers the whole packet, followed by smuggled SMTP commands.
- The network process forwards the payload and the SMTP server processes the smuggled commands.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A web page normally runs in a locked-down part of the browser called the renderer, and it is not supposed to open connections to sensitive ports such as email (SMTP). This report says that if an attacker already controls that renderer, they can ask a more privileged browser component to open the connection anyway, because that component only blocks such ports on the local machine. The attacker could then talk to internal services that should not be reachable from a web page.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.