{"schemaVersion":4,"id":"CVE-2026-95821","aliases":[],"status":"published","duplicateOf":null,"title":"Dangling stack pointer left installed as TCP receive callback after a failed SOCKS5 handshake","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.","dates":{"published":"2026-11-29T20:56:41.209Z","modified":"2026-12-03T21:09:31.647Z","reserved":null,"kevAdded":[],"kevDue":[]},"cvss":{"headline":{"score":6.5,"severity":"medium","version":"3.1","versionLabel":"v3.1","source":"CVE.org","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L","computed":false,"selection":"backend-summary"},"metrics":[{"version":"3.1","versionLabel":"v3.1","source":"CVE.org","score":6.5,"severity":"medium","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L","exploitability":null,"impact":null,"computed":false},{"version":"3.1","versionLabel":"v3.1","source":"NVD","score":6.5,"severity":"medium","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L","exploitability":null,"impact":null,"computed":false}]},"epss":{"probability":0.00465,"percentile":0.4197,"severity":"low","asOf":"2026-12-04T00:00:00.000Z","change":{"pp":null,"baselineDate":null,"baselineScore":null},"history":[{"date":"2026-11-30T00:00:00.000Z","score":0.00465,"percentile":null},{"date":"2026-12-01T00:00:00.000Z","score":0.00465,"percentile":null},{"date":"2026-12-02T00:00:00.000Z","score":0.00465,"percentile":null},{"date":"2026-12-03T00:00:00.000Z","score":0.00465,"percentile":null},{"date":"2026-12-04T00:00:00.000Z","score":0.00465,"percentile":0.4197}],"last30":[{"date":"2026-11-30T00:00:00.000Z","score":0.00465,"percentile":null},{"date":"2026-12-01T00:00:00.000Z","score":0.00465,"percentile":null},{"date":"2026-12-02T00:00:00.000Z","score":0.00465,"percentile":null},{"date":"2026-12-03T00:00:00.000Z","score":0.00465,"percentile":null},{"date":"2026-12-04T00:00:00.000Z","score":0.00465,"percentile":0.4197}]},"kev":{"state":"not-listed","entries":[],"listedCount":0,"totalCatalogs":3,"catalogs":[{"source":"cisa","label":"CISA","listed":false,"entry":null},{"source":"enisa","label":"ENISA","listed":false,"entry":null},{"source":"circl","label":"CIRCL","listed":false,"entry":null}]},"ransomware":{"state":"none-recorded","sources":[]},"exploits":[],"exploitCount":0,"weaknesses":[{"id":"CWE-825","name":"Expired Pointer Dereference","description":"The product dereferences a pointer that contains a location for memory that was previously valid, but is no longer valid.","type":"weakness","status":"Incomplete","abstraction":"Base","likelihoodOfExploit":null,"url":"https://cwe.mitre.org/data/definitions/825.html"}],"affected":[{"vendor":"zephyrproject","product":"zephyr","name":"zephyr","label":"zephyr","ecosystem":null,"cpePart":"a","purl":null,"purlType":null,"versions":[{"text":"≥ 2.0.0, < 4.3.2","noFixRecorded":false,"fixedIn":null,"bounds":{"kind":"range","start":"2.0.0","startInclusive":true,"end":"4.3.2","endInclusive":false}},{"text":"≥ 4.4.0, < 4.5.0","noFixRecorded":false,"fixedIn":null,"bounds":{"kind":"range","start":"4.4.0","startInclusive":true,"end":"4.5.0","endInclusive":false}}],"versionsText":"≥ 2.0.0, < 4.3.2 | ≥ 4.4.0, < 4.5.0","eol":null,"hubHref":"/vendor/zephyrproject/zephyr"}],"affectedCount":1,"eol":{"hasEol":false,"count":0},"references":[{"url":"https://github.com/zephyrproject-rtos/zephyr/commit/5bf0cb3eef2f9d5700d35df8e84a8cd52be47af7","label":"github.com/zephyrproject-rtos/zephyr/commit/5bf0cb3eef2f9d5700d35df8e84a8cd52be47af7","hostname":"github.com","tags":["Patch"]},{"url":"https://github.com/zephyrproject-rtos/zephyr/pull/126144","label":"github.com/zephyrproject-rtos/zephyr/pull/126144","hostname":"github.com","tags":[]},{"url":"https://github.com/zephyrproject-rtos/zephyr/security/advisories/GHSA-jc9q-r4vv-8jjx","label":"github.com/zephyrproject-rtos/zephyr/security/advisories/GHSA-jc9q-r4vv-8jjx","hostname":"github.com","tags":[]}],"lineage":{"upstream":[],"downstream":[],"duplicates":[],"related":[]},"timeline":[{"kind":"published","date":"2026-11-29T20:56:41.209Z","label":"Published","detail":"Vulnerability first disclosed.","source":null},{"kind":"modified","date":"2026-12-03T21:09:31.647Z","label":"Last modified","detail":"Vulnerability information updated.","source":null}],"priority":{"label":"routine","tag":null,"reason":"Not severe (CVSS 6.5, network access); no exploitation reported by the 5 checked sources","nextStep":"Fix in the normal cadence","rank":[0,0,0,0,0,65],"checkedSources":["cisa","enisa","circl","shadowserver","cisa-adp"],"evidence":[{"type":"epss","source":"FIRST","date":"2026-12-04T00:00:00.000Z","status":"valid","statusDate":null,"statusSource":null,"disputes":[],"value":0.00465,"stale":false,"promoted":null},{"type":"cvss","source":"cve.org","date":"2026-12-03T21:09:31.647Z","status":"valid","statusDate":null,"statusSource":null,"disputes":[],"score":6.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L","version":"3.1","headline":true},{"type":"cvss","source":"nvd","date":"2026-12-03T21:09:31.647Z","status":"valid","statusDate":null,"statusSource":null,"disputes":[],"score":6.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L","version":"3.1"},{"type":"adp","source":"cisa-adp","date":"2026-12-03T21:09:23.307Z","status":"valid","statusDate":null,"statusSource":null,"disputes":[],"exploitation":"none"}],"epss":{"value":0.00465,"date":"2026-12-04T00:00:00.000Z","stale":false,"promoted":null},"sources":[{"id":"cisa","lastSuccessfulSync":"2026-12-05T07:02:00.704Z","state":"fresh"},{"id":"enisa","lastSuccessfulSync":"2026-12-05T07:02:01.187Z","state":"fresh"},{"id":"circl","lastSuccessfulSync":"2026-12-05T07:02:01.389Z","state":"fresh"},{"id":"shadowserver","lastSuccessfulSync":null,"state":"unavailable"},{"id":"cisa-adp","lastSuccessfulSync":"2026-12-05T07:01:05.155Z","state":"fresh"},{"id":"epss","lastSuccessfulSync":"2026-12-05T07:01:59.185Z","state":"fresh"},{"id":"osv","lastSuccessfulSync":"2026-12-05T07:01:58.234Z","state":"fresh"}],"feedEvent":null},"meta":{"dataAsOf":"2026-12-05T08:03:08.271Z","stale":false,"partial":false}}