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
·
Updated

The SOCKS5 client in subsys/net/lib/socks/socks.c built the CONNECT request in socks5tcpconnect() by choosing the SOCKS5 address type from the address family of the proxy (proxy->safamily) 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: setcontextproxy() only requires the proxy family to match the socket, and zsockconnectctx() enters the SOCKS branch before any destination validation. With an IPv6 proxy and an AFINET destination the code treated an 8-byte struct netsockaddrin as a struct netsockaddrin6 and copied the 16-byte sin6addr from it, reading 12 bytes past the end of the object and transmitting them to the proxy.

With CONFIGUSERSPACE enabled, zvrfyzsockconnect() copies only addrlen user bytes into a stack-resident struct netsockaddrstorage 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 AFINET6 stream socket, point setsockopt(SOSOCKS5) at a proxy it controls, and call connect() with a short AFINET destination to have the kernel send it 12 bytes of supervisor stack residue per attempt. Without CONFIGUSERSPACE the read runs past the end of the caller's own struct netsockaddrin, 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 SOCKS5ATYPIPV4 from the first four bytes of the IPv6 address, causing the proxy to connect to an unrelated host. Exploitation requires the non-default CONFIGSOCKS option, a socket with SOSOCKS5 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->safamily and validates destlen against the matching struct netsockaddrin/struct netsockaddrin6 before copying, rejecting under-length or unsupported destinations with an error.

Affected Software

1 affected component
Zephyr Project Zephyr

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Compensating control

    In the SOCKS5 CONNECT request builder, select the SOCKS5 address type from dest->sa_family, validate dest_len against the matching struct net_sockaddr_in or struct net_sockaddr_in6 before copying, and reject under-length or unsupported destinations.

Event History

Nov 17, 2026
CVE Published
via MITRE·07:39 PM
Data Sourced
via MITRE·07:39 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·08:17 PM
DescriptionSeverityWeakness

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203