CVE-2026-10643: Out-of-bounds heap write in Zephyr `recvmsg()` ancillary-data path (`insert_pktinfo` undersizes the control-buffer capacity check)
Zephyr's IP socket recvmsg() implementation (subsys/net/lib/sockets/socketsinet.c, insertpktinfo()) validated the user-supplied ancillary (msgcontrol) buffer using only the payload length (msg->msgcontrollen < pktinfolen) before writing a full control message consisting of an aligned cmsg header plus the payload. Because the check omitted the cmsg header size, a control buffer whose length falls in the under-checked window (e.g. 16-27 bytes for IPv4 IPPKTINFO on a 64-bit target, where a single element actually occupies 28 bytes) passes the guard yet causes a fixed-size out-of-bounds write of up to one cmsg header (~12 bytes) past the end of the buffer.
Under CONFIGUSERSPACE the recvmsg verifier allocates a kernel-heap copy of the control buffer sized to msgcontrollen and runs the implementation against it, so the overflow corrupts kernel heap memory and is triggerable from an unprivileged userspace thread; in supervisor mode it corrupts the caller's buffer.
The path is reachable on a UDP/IP socket with IPPKTINFO/IPV6RECVPKTINFO (or hoplimit/timestamping) enabled when the application calls recvmsg() with an undersized control buffer and a datagram is received; part of the overwritten bytes (the destination IP in ipiaddr) is influenced by the received packet.
The fix makes the capacity check use NETCMSGSPACE(pktinfolen) (aligned header + aligned data) and returns -ENOMEM when the buffer is too small. Affected: v3.6.0 through v4.4.0.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
Zephyrto a version that resolves this vulnerability.Fixed in v4.4.0 - Configuration
In insert_pktinfo(), update the msg_controllen/msg->msg_controllen validation to use NET_CMSG_SPACE(pktinfo_len) so the code does not write a full cmsg header (~12 bytes) plus payload past the end of the control buffer; if the buffer is too small, return -ENOMEM.
Zephyr recvmsg ancillary-data path (subsys/net/lib/sockets/sockets_inet.c, insert_pktinfo()) control-buffer capacity check = Use NET_CMSG_SPACE(pktinfo_len) (aligned cmsg header + aligned data) instead of checking only payload length - Compensating control
Restrict exposure by ensuring unprivileged userspace threads cannot call recvmsg() on UDP/IP sockets with IP_PKTINFO/IPV6_RECVPKTINFO (or hoplimit/timestamping) enabled using an undersized control buffer.
Event History
Frequently Asked Questions
What is the severity of CVE-2026-10643?
CVE-2026-10643 has a severity rating of high at 8.7.
How do I fix CVE-2026-10643?
To fix CVE-2026-10643, you should update to the latest version of Zephyr Project that addresses this vulnerability.
What is the impact of CVE-2026-10643?
CVE-2026-10643 can potentially allow an attacker to execute arbitrary code due to an out-of-bounds heap write.
Which software is affected by CVE-2026-10643?
CVE-2026-10643 affects the Zephyr Project's implementation of IP sockets, specifically the recvmsg() function.
When was CVE-2026-10643 published?
CVE-2026-10643 was published on June 27, 2026.