{"id":"CVE-2026-95821","aliases":[],"cve":{"records":[{"id":"CVE-2026-95821","source":"zephyr","state":"PUBLISHED","reasons":[],"replacements":[],"disputed":false,"unsupportedWhenAssigned":false,"reserved":"2026-09-22T16:11:41.898Z","published":"2026-11-29T20:56:41.209Z","modified":"2026-11-29T20:56:41.209Z"}],"publishers":[{"name":"zephyr","role":"CNA","organizationId":"e2e69745-5e70-4e92-8431-deb5529a81ad","modified":"2026-11-29T20:56:41.209Z"}],"references":[{"url":"https://github.com/zephyrproject-rtos/zephyr/commit/5bf0cb3eef2f9d5700d35df8e84a8cd52be47af7","tags":["patch"],"source":"zephyr"},{"url":"https://github.com/zephyrproject-rtos/zephyr/pull/126144","tags":[],"source":"zephyr"},{"url":"https://github.com/zephyrproject-rtos/zephyr/security/advisories/GHSA-jc9q-r4vv-8jjx","tags":[],"source":"zephyr"}],"weaknesses":[{"id":"CWE-825","description":"memory-safety","source":"zephyr"}],"applicability":[],"prioritization":[]},"title":"Dangling stack pointer left installed as TCP receive callback after a failed SOCKS5 handshake","titleSource":"zephyr","descriptionSource":"zephyr","description":"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.\n\nAny 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.\n\nThe 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.\n\nThe 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.","score":6.5,"severity":"medium","published":"2026-11-29T20:56:41.209Z","modified":"2026-11-29T20:56:41.209Z","withdrawn":false,"knownExploited":false,"affected":[],"products":[{"vendor":"zephyrproject","name":"zephyr","platforms":[],"versions":[{"version":"2.0.0","status":"affected","lessThan":"4.3.2","versionType":"semver"},{"version":"4.4.0","status":"affected","lessThan":"4.5.0","versionType":"semver"}],"defaultStatus":"unaffected","cpes":[],"source":"zephyr","url":"https://www.cve.org/CVERecord?id=CVE-2026-95821"}],"remediation":[],"references":["https://github.com/zephyrproject-rtos/zephyr/commit/5bf0cb3eef2f9d5700d35df8e84a8cd52be47af7","https://github.com/zephyrproject-rtos/zephyr/pull/126144","https://github.com/zephyrproject-rtos/zephyr/security/advisories/GHSA-jc9q-r4vv-8jjx"],"sources":[{"name":"CVE","id":"CVE-2026-95821","modified":"2026-11-29T20:56:41.209Z","url":"https://www.cve.org/CVERecord?id=CVE-2026-95821"}],"assessments":[{"source":"zephyr","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L","score":6.5}],"sourceAffected":[],"observedAt":"2026-11-29T21:05:54.474Z","kev":{"status":"not-listed","checkedAt":"2026-11-30T22:55:31.926Z"},"coverage":[{"source":"NVD","status":"available","checkedAt":"2026-11-29T21:20:31.531Z","attemptedAt":"2026-11-29T21:20:31.531Z"},{"source":"GHSA","status":"no-result","checkedAt":"2026-11-29T21:20:32.554Z","attemptedAt":"2026-11-29T21:20:32.554Z"},{"source":"EUVD","status":"no-result","checkedAt":"2026-11-29T21:20:30.247Z","attemptedAt":"2026-11-29T21:20:30.247Z"},{"source":"EPSS","status":"no-result","checkedAt":"2026-11-29T21:20:31.529Z","attemptedAt":"2026-11-29T21:20:31.529Z"}],"evidence":[{"source":"NVD","id":"CVE-2026-95821","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-95821","modified":"2026-11-29T21:17:03.097","score":6.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L","checkedAt":"2026-11-29T21:20:31.531Z"}],"aiSummary":{"text":"The Zephyr project's SOCKS5 client in versions 2.0.0 to 4.3.2 and 4.4.0 to 4.5.0 has a dangling stack pointer vulnerability. A remote peer can trigger this issue by responding with certain protocol-legal responses, causing a write of peer-supplied bytes to a stack region. This can lead to limited corruption or a crash.","model":"@cf/meta/llama-3.3-70b-instruct-fp8-fast","generatedAt":"2026-11-29T21:06:40.721Z","sources":[{"name":"CVE","url":"https://www.cve.org/CVERecord?id=CVE-2026-95821"}]}}