Home › CVE › Vulnerabilities
CVE-2026-95821 — zephyrproject zephyr
One of 10 zephyrproject zephyr vulnerabilities published together by NVD: our article covers all of them.
VulnerabilitiesSummary
The SOCKS5 client in subsys/net/lib/socks/socks.c passes the addresses of two of socks5_tcp_connect()'s own stack variables, method_rsp and cmd_rsp, to net_context_recv() as the user data for the negotiation and CONNECT response callbacks. For a TCP context net_context_recv() reaches net_tcp_recv(), which only stores context->recv_cb and conn->recv_user_data and never removes them. On the success path zsock_connect_ctx() immediately replaces them with zsock_received_cb(), but on every error path nothing did, so the network context was left holding a pointer into a stack frame that had already been destroyed. Any remote peer acting as the proxy can arm this with a protocol-legal response: answering the method negotiation with NO ACCEPTABLE METHODS (0xFF), sending a bad version byte, returning a non-success REP in the CONNECT reply, or simply stalling until CONFIG_NET_SOCKETS_CONNECT_TIMEOUT expires all make socks5_tcp_connect() return an error while the callbacks stay installed. The dangling pointer is then dereferenced asynchronously from the networking threads: tcp_conn_close() in subsys/net/ip/tcp.c invokes context->recv_cb() on FIN, RST or timeout, and the callback memset()s through the stale pointer, while any further data on the socket reaches net_context_packet_received() and makes net_pkt_read() write peer-supplied bytes there. The result is a write of two to four bytes (zeroes on the teardown path, peer-chosen bytes on the data path) into a stack region of the thread that called connect(), at a moment when that thread may have reused the memory for a live frame. The write address is not attacker-controlled, so the practical impact is limited corruption or a crash rather than a directed memory-write primitive; the author observed it as a SEGV in tcp_conn_close() under CONFIG_ASAN. Only configurations with CONFIG_SOCKS enabled and a SOCKS5 proxy configured on the socket are affected. The fix routes the error returns through a common exit that calls net_context_recv(ctx, NULL, K_NO_WAIT, NULL), uninstalling the callback and the user-data pointer before the stack frame goes away.
Severity breakdown
Medium · 6.5
An attacker without an account can exploit this over the network, without any user action.
- Attack from
- the network (remotely)
- Attack complexity
- low (no special conditions)
- Login needed
- no
- User action needed
- no
- Scope
- stays within the vulnerable component
- Impact
- low on integrity and availability, none on confidentiality
Weakness
- CWE-825: Expired Pointer Dereference
Affected and fixed versions
| Product | Affected versions | Fixed in |
|---|---|---|
| zephyrproject zephyr | ≥ 2.0.0, < 4.3.2 | 4.3.2 |
| ≥ 4.4.0, < 4.5.0 | 4.5.0 |
References by type
Vendor advisories
Patches and fixed releases
Affected
- zephyrproject zephyr
What to do
- Follow the vendor advisory and the references below for fixed versions and workarounds.
Frequently asked questions
What is CVE-2026-95821?
The SOCKS5 client in subsys/net/lib/socks/socks.c passes the addresses of two of socks5tcpconnect()'s own stack variables, methodrsp and cmdrsp, to netcontextrecv() as the user data for the negotiation and CONNECT response callbacks. For a TCP context netcontextrecv() reaches nettcprecv(), which only stores context->recvcb and conn->recvuserdata and never removes them. Weakness type: Expired Pointer Dereference (CWE-825).
How severe is CVE-2026-95821?
CVE-2026-95821 has a CVSS 3.1 base score of 6.5 (medium), from the CNA (zephyrproject.org). An attacker without an account can exploit this over the network, without any user action.
Is CVE-2026-95821 being exploited?
Not as far as is known: CVE-2026-95821 is not in CISA's Known Exploited Vulnerabilities catalog as of November 29, 2026.
Which versions are affected by CVE-2026-95821?
zephyrproject zephyr ≥ 2.0.0, < 4.3.2 (fixed in 4.3.2); zephyrproject zephyr ≥ 4.4.0, < 4.5.0 (fixed in 4.5.0).
How do I fix CVE-2026-95821?
Update to a fixed release: zephyrproject zephyr 4.3.2; zephyrproject zephyr 4.5.0.