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

> A race condition in Zephyr RTOS socket verifiers allows local attackers to corrupt kernel memory, leading to privilege escalation or denial of service.

- **Severity:** High 7.8 (`CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** No
- **Published:** 12 Aug 2026
- **Updated:** 12 Aug 2026
- **Also known as:** GHSA-fcp3-vrr2-xfjv

## What is CVE-2026-12234?

CVE-2026-12234 is a high-severity vulnerability in zephyrproject zephyr, published on 12 Aug 2026. It can only be exploited from the same machine or local network, with no action from the victim.

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

Weakness: CWE-367 (Time-of-check Time-of-use (TOCTOU) Race Condition)

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


## How do I fix CVE-2026-12234?

No fix has been published for CVE-2026-12234 yet. Limit exposure of the affected software until one is available.

## Is CVE-2026-12234 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-12234 exists.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-12234 and fix it if it is affected.

What it is: CVE-2026-12234 is a high-severity vulnerability in zephyrproject zephyr, published on 12 Aug 2026. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-12234 exists.

Affected product: zephyrproject zephyr. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-12234/ (Markdown: https://insights.sbomify.com/CVE-2026-12234/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-12234
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-12234
- OSV: https://osv.dev/vulnerability/CVE-2026-12234

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-12234/
Summaries are generated and may contain mistakes; the official description above is the record.
