# CVE-2026-95821: Dangling stack pointer left installed as TCP receive callback after a failed SOCKS5 handshake

- **Severity:** MEDIUM 6.5
- **CVSS:** 6.5 (v3.1, CNA) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L`
- **CVSS metrics:** Attack vector: Network; Attack complexity: Low; Privileges required: None; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: Low; Availability impact: Low
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Remote, no login needed
- **EPSS:** 0.46% (percentile 42, 2026-12-01)
- **CWE:** CWE-825
- **Published:** 2026-11-29T20:56:41.209Z
- **Modified:** 2026-11-29T21:17:03.097Z

> **AI summary (AI-generated, claude-haiku-5-5):** A malicious SOCKS5 proxy can make Zephyr's SOCKS5 client leave a dangling stack pointer as a TCP receive callback, letting it corrupt the connecting thread's stack or crash the device.

## Who should check

- Anyone running zephyrproject zephyr \>= 2.0.0, \< 4.3.2; \>= 4.4.0, \< 4.5.0

## 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.

Any 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.

The 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.

The 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.

## Affected and fixed versions

- zephyrproject zephyr: \>= 2.0.0, \< 4.3.2; \>= 4.4.0, \< 4.5.0 (cvelist)

## Technologies

Zephyr RTOS

## Mitigation

- Upgrade zephyr to 4.5.0 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2026-95821. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2026-95821.md
Affected: zephyrproject zephyr >= 2.0.0, < 4.3.2; >= 4.4.0, < 4.5.0
Fixed in: zephyrproject zephyr 4.3.2, zephyrproject zephyr 4.5.0

Steps:
1. Search this machine and project for zephyrproject zephyr: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2026-95821 being exploited?

There is no confirmed exploitation: CVE-2026-95821 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.46% chance of exploitation in the next 30 days (as of 2026-12-01).

### How serious is CVE-2026-95821?

Medium: CVSS 6.5 (v3.1, scored by CNA). Remote, no login needed.

### Which versions are affected by CVE-2026-95821?

zephyrproject zephyr \>= 2.0.0, \< 4.3.2; \>= 4.4.0, \< 4.5.0.

### Is there a fix for CVE-2026-95821?

Yes. Fixed in zephyrproject zephyr 4.3.2, zephyrproject zephyr 4.5.0. Upgrade zephyr to 4.5.0 or later.

### How do I check if I'm affected by CVE-2026-95821?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://github.com/zephyrproject-rtos/zephyr/security/advisories/GHSA-jc9q-r4vv-8jjx>
- patch: <https://github.com/zephyrproject-rtos/zephyr/commit/5bf0cb3eef2f9d5700d35df8e84a8cd52be47af7>
- patch: <https://github.com/zephyrproject-rtos/zephyr/pull/126144>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2026-95821>
- FIRST EPSS: EPSS scores by FIRST <https://www.first.org/epss/>

HTML: <https://flawdb.com/CVE-2026-95821> · JSON: <https://flawdb.com/api/v1/entries/CVE-2026-95821>
