CVE-2026-86086: Unvalidated userspace pointer dereference in zsock_getsockopt syscall verifier allows limited kernel memory disclosure and system halt
The CONFIGUSERSPACE syscall verifier for getsockopt() in subsys/net/lib/sockets/sockets.c dereferenced the caller-supplied optlen pointer without validating it. zvrfyzsockgetsockopt() began with netsocklent kerneloptlen = (netsocklent )optlen;, reading four bytes through an unprivileged thread's pointer while executing in supervisor mode, before any KSYSCALLMEMORYREAD or kusermodefromcopy() check. Every sibling verifier in the same file — zvrfyzsockaccept(), zvrfyzsockrecvfrom(), zvrfyzsockgetpeername(), zvrfyzsockgetsockname() — validated the equivalent addrlen pointer correctly; getsockopt was the sole outlier.
zsockgetsockopt() is declared syscall in include/zephyr/net/socket.h, so any user-mode thread holding (or able to create) a socket can invoke it directly with an arbitrary pointer value. No preparation, race, or heap grooming is required: a single call is enough. The issue is only present in builds with CONFIGUSERSPACE=y and CONFIGNETSOCKETS=y, which is precisely the configuration intended to contain an untrusted thread.
The word read is not returned to the caller directly: the trailing kusermodetocopy() writes the updated length back through optlen itself, and for a kernel address that write is rejected with a kernel oops. The leak is instead an oracle. The word read through optlen becomes the length checked by KSYSCALLMEMORYWRITE(optval, kerneloptlen): a value larger than the caller's writable span at optval fails cleanly with -EPERM, while a smaller one proceeds to the oopsing write-back (or, for a large value, to a failed kusermodeallocfromcopy()). A thread can therefore learn whether a chosen kernel word is below a chosen threshold, but every "yes" answer costs a fatal error, which keeps the disclosure limited. That fatal error is the larger impact: the default ksysfatalerrorhandler() halts or warm-reboots the whole system on a kernel oops rather than aborting only the offending thread, and passing NULL or an address not mapped for supervisor access as optlen faults in supervisor mode with the same result. The subsequent length-bounded copies remain checked, so there is no out-of-bounds write.
The fix replaces the raw dereference with KOOPS(kusermodefromcopy(&kerneloptlen, optlen, sizeof(netsocklent))), which validates read access before copying and turns a malicious pointer into a clean kernel oops on the calling thread.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In z_vrfy_zsock_getsockopt(), replace the raw optlen dereference with K_OOPS(k_usermode_from_copy(&kernel_optlen, optlen, sizeof(net_socklen_t))) so read access is validated before copying.
Event History
Frequently Asked Questions
Which deployments are exposed?
Only builds that enable both CONFIG_USERSPACE=y and CONFIG_NET_SOCKETS=y are affected. These are deployments intended to run untrusted user-mode threads with socket access.
What access does an attacker need to trigger the issue?
An attacker needs to execute an unprivileged user-mode thread that holds, or can create, a socket. They can invoke zsock_getsockopt() directly with an arbitrary optlen pointer; no race, heap grooming, or other preparation is required.
Is exploit code publicly available?
Yes. The available event data records that an exploit was published on 2026-10-13.