CVE-2026-95822

Out-of-bounds read and kernel stack disclosure in the SOCKS5 client when the destination address family differs from the proxy address family

Published Nov 17, 2026 CVSS 3.1 · 3.3 Low EPSS < 1% KEV · Not listed
Description
The SOCKS5 client in subsys/net/lib/socks/socks.c built the CONNECT request in socks5_tcp_connect() by choosing the SOCKS5 address type from the address family of the proxy (proxy->sa_family) while reading the bytes out of the destination address supplied to connect(). A SOCKS5 request encodes the destination independently of the transport used to reach the proxy, so the two families are unrelated and nothing in the path forces them to agree: set_context_proxy() only requires the proxy family to match the socket, and zsock_connect_ctx() enters the SOCKS branch before any destination validation. With an IPv6 proxy and an AF_INET destination the code treated an 8-byte struct net_sockaddr_in as a struct net_sockaddr_in6 and copied the 16-byte sin6_addr from it, reading 12 bytes past the end of the object and transmitting them to the proxy.

With CONFIG_USERSPACE enabled, z_vrfy_zsock_connect() copies only addrlen user bytes into a stack-resident struct net_sockaddr_storage and enforces no per-family minimum length, so the oversized read stays within the storage but returns stale, uninitialised kernel-stack bytes. An unprivileged user-mode thread can therefore open an AF_INET6 stream socket, point setsockopt(SO_SOCKS5) at a proxy it controls, and call connect() with a short AF_INET destination to have the kernel send it 12 bytes of supervisor stack residue per attempt. Without CONFIG_USERSPACE the read runs past the end of the caller's own struct net_sockaddr_in, disclosing adjacent memory to the proxy; the family mismatch can arise unintentionally when a destination is obtained from DNS while an IPv6 proxy is configured.

Impact is limited to information disclosure of at most 12 bytes per connect() call, with no write primitive; the leak is delivered to whoever operates the SOCKS5 proxy. The mirrored pairing (IPv6 destination through an IPv4 proxy) is memory-safe but encoded the destination as SOCKS5_ATYP_IPV4 from the first four bytes of the IPv6 address, causing the proxy to connect to an unrelated host. Exploitation requires the non-default CONFIG_SOCKS option, a socket with SO_SOCKS5 configured, and both IPv4 and IPv6 support in the image.

The fix moves the encoding into a helper that selects the address type from dest->sa_family and validates dest_len against the matching struct net_sockaddr_in/struct net_sockaddr_in6 before copying, rejecting under-length or unsupported destinations with an error.

Analysis

AI-generated

Technical impact

The vulnerability is an out‑of‑bounds read in the SOCKS5 client of Zephyr’s networking stack. The CONNECT request builder incorrectly selects the address type from the proxy’s family while reading bytes from the destination address. When an IPv6 proxy is used with an IPv4 destination, the code treats a 16‑byte IPv6 address as a 12‑byte IPv4 structure, copying 12 bytes past the end of the destination object and exposing stale kernel‑stack data to the SOCKS5 proxy. The leak is limited to 12 bytes per connect() call and provides only information disclosure; no writable or privileged escalation primitive exists.

Affected Systems

Zephyr Project Zephyr RTOS builds that enable CONFIG_SOCKS, contain SOCKS5 support, and compile with both IPv4 and IPv6 networking enabled. Any image where the configuration option CONFIG_SOCKS is set and a user can set the SO_SOCKS5 socket option may be affected.

Risk and Exploitability

The CVSS score of 3.3 indicates low overall severity. EPSS data is not available and the vulnerability is not listed in the CISA KEV catalog, suggesting limited current exploitation evidence. An attacker must control a SOCKS5 proxy and have a user‑mode thread that can send a connect request with a mismatched address family. The attack vector is therefore local or remote but requires attacker control of the proxy; the exposure would be to the proxy operator rather than to an external target.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade to a Zephyr patch that corrects address‑family handling in the SOCKS5 client as described in the official commit
  • Disallow the use of the SOCKS5 option (CONFIG_SOCKS) or remove SO_SOCKS5 from sockets that do not require it
  • If upgrading is not possible, ensure that only trusted entities can operate the SOCKS5 proxy to mitigate the potential leakage

Generated by OpenCVE AI on November 17, 2026 at 20:50 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Zephyrproject
Zephyrproject zephyr
Vendors & Products Zephyrproject
Zephyrproject zephyr
Type Values Removed Values Added
Description The SOCKS5 client in subsys/net/lib/socks/socks.c built the CONNECT request in socks5_tcp_connect() by choosing the SOCKS5 address type from the address family of the proxy (proxy->sa_family) while reading the bytes out of the destination address supplied to connect(). A SOCKS5 request encodes the destination independently of the transport used to reach the proxy, so the two families are unrelated and nothing in the path forces them to agree: set_context_proxy() only requires the proxy family to match the socket, and zsock_connect_ctx() enters the SOCKS branch before any destination validation. With an IPv6 proxy and an AF_INET destination the code treated an 8-byte struct net_sockaddr_in as a struct net_sockaddr_in6 and copied the 16-byte sin6_addr from it, reading 12 bytes past the end of the object and transmitting them to the proxy. With CONFIG_USERSPACE enabled, z_vrfy_zsock_connect() copies only addrlen user bytes into a stack-resident struct net_sockaddr_storage and enforces no per-family minimum length, so the oversized read stays within the storage but returns stale, uninitialised kernel-stack bytes. An unprivileged user-mode thread can therefore open an AF_INET6 stream socket, point setsockopt(SO_SOCKS5) at a proxy it controls, and call connect() with a short AF_INET destination to have the kernel send it 12 bytes of supervisor stack residue per attempt. Without CONFIG_USERSPACE the read runs past the end of the caller's own struct net_sockaddr_in, disclosing adjacent memory to the proxy; the family mismatch can arise unintentionally when a destination is obtained from DNS while an IPv6 proxy is configured. Impact is limited to information disclosure of at most 12 bytes per connect() call, with no write primitive; the leak is delivered to whoever operates the SOCKS5 proxy. The mirrored pairing (IPv6 destination through an IPv4 proxy) is memory-safe but encoded the destination as SOCKS5_ATYP_IPV4 from the first four bytes of the IPv6 address, causing the proxy to connect to an unrelated host. Exploitation requires the non-default CONFIG_SOCKS option, a socket with SO_SOCKS5 configured, and both IPv4 and IPv6 support in the image. The fix moves the encoding into a helper that selects the address type from dest->sa_family and validates dest_len against the matching struct net_sockaddr_in/struct net_sockaddr_in6 before copying, rejecting under-length or unsupported destinations with an error.
Title Out-of-bounds read and kernel stack disclosure in the SOCKS5 client when the destination address family differs from the proxy address family
Weaknesses CWE-125
References
Metrics cvssV3_1

{'score': 3.3, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N'}

Weaknesses

Sources

Status
PUBLISHED
Assigner
zephyr
Published
Updated
Nov 17, 2026, 8:13 PM
Reserved
Sep 22, 2026, 4:11 PM
Status
Awaiting Analysis
Published
Nov 17, 2026, 8:17 PM
Modified
Nov 17, 2026, 8:17 PM