{"api_version":"1","generated_at":"2026-11-30T01:20:10+00:00","cve":"CVE-2026-95821","urls":{"html":"https://cve.report/CVE-2026-95821","api":"https://cve.report/api/cve/CVE-2026-95821.json","docs":"https://cve.report/api","cve_org":"https://www.cve.org/CVERecord?id=CVE-2026-95821","nvd":"https://nvd.nist.gov/vuln/detail/CVE-2026-95821"},"summary":{"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.","state":"PUBLISHED","assigner":"zephyr","published_at":"2026-11-29 21:17:02","updated_at":"2026-11-29 21:17:03"},"problem_types":["CWE-825","CWE-825 memory-safety"],"metrics":[{"version":"3.1","source":"vulnerabilities@zephyrproject.org","type":"Secondary","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","data":{"version":"3.1","vectorString":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L","baseScore":6.5,"baseSeverity":"MEDIUM","attackVector":"NETWORK","attackComplexity":"LOW","privilegesRequired":"NONE","userInteraction":"NONE","scope":"UNCHANGED","confidentialityImpact":"NONE","integrityImpact":"LOW","availabilityImpact":"LOW"}},{"version":"3.1","source":"CNA","type":"CVSS","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","data":{"baseScore":6.5,"baseSeverity":"MEDIUM","vectorString":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L","version":"3.1"}}],"references":[{"url":"https://github.com/zephyrproject-rtos/zephyr/commit/5bf0cb3eef2f9d5700d35df8e84a8cd52be47af7","name":"https://github.com/zephyrproject-rtos/zephyr/commit/5bf0cb3eef2f9d5700d35df8e84a8cd52be47af7","refsource":"vulnerabilities@zephyrproject.org","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://github.com/zephyrproject-rtos/zephyr/security/advisories/GHSA-jc9q-r4vv-8jjx","name":"https://github.com/zephyrproject-rtos/zephyr/security/advisories/GHSA-jc9q-r4vv-8jjx","refsource":"vulnerabilities@zephyrproject.org","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://github.com/zephyrproject-rtos/zephyr/pull/126144","name":"https://github.com/zephyrproject-rtos/zephyr/pull/126144","refsource":"vulnerabilities@zephyrproject.org","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://www.cve.org/CVERecord?id=CVE-2026-95821","name":"CVE Program record","refsource":"CVE.ORG","tags":["canonical"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-95821","name":"NVD vulnerability detail","refsource":"NVD","tags":["canonical","analysis"]}],"affected":[{"source":"CNA","vendor":"zephyrproject","product":"zephyr","version":"affected 2.0.0 4.3.2 semver","platforms":[]},{"source":"CNA","vendor":"zephyrproject","product":"zephyr","version":"affected 4.4.0 4.5.0 semver","platforms":[]}],"timeline":[],"solutions":[],"workarounds":[],"exploits":[],"credits":[{"source":"CNA","value":"torjan0","lang":"en"}],"nvd_cpes":[],"vendor_comments":[],"enrichments":{"kev":null,"epss":null,"legacy_qids":[]},"source_records":{"cve_program":{"containers":{"cna":{"affected":[{"collectionURL":"https://github.com/zephyrproject-rtos/zephyr","defaultStatus":"unaffected","packageName":"zephyr","product":"zephyr","programFiles":["subsys/net/lib/socks/socks.c"],"programRoutines":[{"name":"socks5_cmd_rsp_cb"},{"name":"socks5_method_rsp_cb"},{"name":"socks5_tcp_connect"}],"vendor":"zephyrproject","versions":[{"lessThan":"4.3.2","status":"affected","version":"2.0.0","versionType":"semver"},{"lessThan":"4.5.0","status":"affected","version":"4.4.0","versionType":"semver"}]}],"credits":[{"lang":"en","type":"reporter","value":"torjan0"}],"descriptions":[{"lang":"en","value":"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."}],"metrics":[{"cvssV3_1":{"baseScore":6.5,"baseSeverity":"MEDIUM","vectorString":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L","version":"3.1"},"format":"CVSS"}],"problemTypes":[{"descriptions":[{"cweId":"CWE-825","description":"memory-safety","lang":"en","type":"CWE"}]}],"providerMetadata":{"dateUpdated":"2026-11-29T20:56:41.209Z","orgId":"e2e69745-5e70-4e92-8431-deb5529a81ad","shortName":"zephyr"},"references":[{"name":"Fix commit","tags":["patch"],"url":"https://github.com/zephyrproject-rtos/zephyr/commit/5bf0cb3eef2f9d5700d35df8e84a8cd52be47af7"},{"name":"Remaining fix: pull request #126144","url":"https://github.com/zephyrproject-rtos/zephyr/pull/126144"},{"name":"GHSA-jc9q-r4vv-8jjx","url":"https://github.com/zephyrproject-rtos/zephyr/security/advisories/GHSA-jc9q-r4vv-8jjx"}],"title":"Dangling stack pointer left installed as TCP receive callback after a failed SOCKS5 handshake","x_generator":{"engine":"cvelib 1.8.0"}}},"cveMetadata":{"assignerOrgId":"e2e69745-5e70-4e92-8431-deb5529a81ad","assignerShortName":"zephyr","cveId":"CVE-2026-95821","datePublished":"2026-11-29T20:56:41.209Z","dateReserved":"2026-09-22T16:11:41.898Z","dateUpdated":"2026-11-29T20:56:41.209Z","state":"PUBLISHED"},"dataType":"CVE_RECORD","dataVersion":"5.2"},"nvd":{"publishedDate":"2026-11-29 21:17:02","lastModifiedDate":"2026-11-29 21:17:03","problem_types":["CWE-825","CWE-825 memory-safety"],"metrics":{"cvssMetricV31":[{"source":"vulnerabilities@zephyrproject.org","type":"Secondary","cvssData":{"version":"3.1","vectorString":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L","baseScore":6.5,"baseSeverity":"MEDIUM","attackVector":"NETWORK","attackComplexity":"LOW","privilegesRequired":"NONE","userInteraction":"NONE","scope":"UNCHANGED","confidentialityImpact":"NONE","integrityImpact":"LOW","availabilityImpact":"LOW"},"exploitabilityScore":3.9,"impactScore":2.5}]},"configurations":[]},"legacy_mitre":{"record":{"CveYear":"2026","CveId":"95821","Ordinal":"1","Title":"Dangling stack pointer left installed as TCP receive callback af","CVE":"CVE-2026-95821","Year":"2026"},"notes":[{"CveYear":"2026","CveId":"95821","Ordinal":"1","NoteData":"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.","Type":"Description","Title":"Dangling stack pointer left installed as TCP receive callback af"}]}}}