# CVE-2026-12234: TOCTOU double-fetch in `zsock_sendmsg`/`recvmsg` userspace verifiers allows kernel-heap out-of-bounds write

- Severity: High 7.8 (CVSS:3.1, scored by zephyr) `CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.08%, higher than 0% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2026-08-12T04:39:23.977Z
- Modified: 2026-10-23T20:10:00.160Z
- Weaknesses: CWE-367
- SSVC (CISA-ADP): exploitation poc, automatable no, technical impact total
- Assigned by: zephyr

## Description

The userspace syscall verifiers z_vrfy_zsock_sendmsg() and z_vrfy_zsock_recvmsg() in subsys/net/lib/sockets/sockets.c snapshot the caller-supplied struct net_msghdr into a kernel-side copy with k_usermode_from_copy(), but then re-read the still-live user struct for subsequent decisions. The kernel iovec shadow buffer is sized from one read of msg->msg_iovlen, while the population loop is bounded by a second, live read of the same field.

Because msg points into ordinary user memory, a cooperating second thread in the same memory domain can inflate msg->msg_iovlen in the window between the sizing read and the loop test (a classic double-fetch / TOCTOU). The population loop then iterates past the number of net_iovec slots actually allocated, writing attacker-influenced iov_base/iov_len values beyond the end of the kernel-heap shadow buffer. The recvmsg verifier has the same defect on both its inbound and result write-back loops.

The code is reachable from an unprivileged user thread whenever CONFIG_USERSPACE is enabled and the zsock_sendmsg/zsock_recvmsg syscalls are available. A successful race corrupts kernel-managed heap memory across the user-to-kernel privilege boundary, yielding a local privilege-escalation primitive or, at minimum, a kernel-fault denial of service. The fix copies the header once and derives every size, bound, and gate from the snapshot, copying each iovec entry atomically so its base and length can no longer be raced apart.

(As written by CVE List.)

## Affected

- zephyr: from 2.3.0 before 4.4.2

## References

- <https://github.com/zephyrproject-rtos/zephyr/security/advisories/GHSA-fcp3-vrr2-xfjv> (exploit)
- <https://github.com/zephyrproject-rtos/zephyr/commit/2e0f9cf05be61056ed1a94dab51b832fbad27e2c> (patch)

## Sources

- CVE List: [CVE-2026-12234](https://www.cve.org/CVERecord?id=CVE-2026-12234), CVE Terms of Use, modified 2026-08-12
- NVD: [CVE-2026-12234](https://nvd.nist.gov/vuln/detail/CVE-2026-12234), Public domain, modified 2026-10-23

---

Page: https://cve.day/CVE-2026-12234 · Whole record: https://cve.day/CVE-2026-12234.json · Rebuilt by cve.day 2026-11-25T22:59:32.539Z
