CVE-2026-93671: Out-of-bounds read logging a mismatched Sec-WebSocket-Accept header in the Zephyr websocket client
The websocket client's HTTP header callback onheadervalue() in subsys/net/lib/websocket/websocket.c receives the Sec-WebSocket-Accept header value as a pointer/length pair from the HTTP parser. The referenced bytes live inside the application-supplied receive buffer and are not NUL terminated. When the received value did not match the expected accept key, the pointer was passed directly to a %s conversion in a NETDBG() call, so the logging code measured the string with strlen() and read on past the end of the header value looking for a terminator.
The value is supplied by the peer during the WebSocket handshake, before any application-level authentication, so a malicious or man-in-the-middle server reached over a ws:// (or otherwise attacker-terminated) connection can trigger the mismatch branch at will simply by answering with a wrong accept key. By sizing the response so the header value ends at the tail of the buffer passed to websocketconnect() as wreq->tmpbuf, the peer can make the scan run off the end of that buffer and into adjacent memory. The defective log statement is compiled in only when websocket debug logging is enabled (CONFIGNETWEBSOCKETLOGLEVELDBG=y, or CONFIGLOGDEFAULTLEVEL=4); it is absent from a default build, which bounds exposure to diagnostic configurations.
The consequence is an out-of-bounds read whose contents are emitted to the log stream: memory adjacent to the receive buffer is disclosed wherever the device's logs are collected or displayed. On targets where the memory following the buffer is not mapped, the scan can instead fault and terminate the connection or thread. No out-of-bounds write occurs, so there is no integrity impact.
The fix copies at most sizeof(got) - 1 bytes of the parser-provided slice into a bounded stack buffer, NUL terminates the copy, and logs that instead, so the formatter never reads beyond the bytes the parser actually offered.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Configuration
Disable websocket debug logging to prevent the vulnerable mismatch-header log statement from being compiled in.
Zephyr websocket client CONFIG_NET_WEBSOCKET_LOG_LEVEL_DBG = disabled
Event History
Frequently Asked Questions
Which deployments are exposed to this issue?
The out-of-bounds read is reachable only when WebSocket debug logging is compiled in, including with CONFIG_NET_WEBSOCKET_LOG_LEVEL_DBG=y. It affects clients that connect to a peer capable of returning a WebSocket handshake response.
What does an attacker need to trigger the read?
An attacker must control the WebSocket server, act as a man-in-the-middle for a ws:// connection, or otherwise terminate the connection. They can send an incorrect Sec-WebSocket-Accept value during the handshake, before application-level authentication.
What can be done if patching is not immediately possible?
Disable WebSocket debug logging so the vulnerable NET_DBG() statement is not compiled in. Avoid connecting to untrusted or attacker-terminated WebSocket endpoints, particularly over ws:// connections.
How can I determine whether a device may already be affected?
Review the build configuration for WebSocket debug logging, especially CONFIG_NET_WEBSOCKET_LOG_LEVEL_DBG=y, and identify clients using websocket_connect() with application-supplied receive buffers. Devices that connect to untrusted WebSocket peers or use ws:// have a practical remote trigger path.