CVE-2026-10643: Zephyr Out-of-Bounds Write in recvmsg() Buffer Handling
A flaw in Zephyr's network socket handling allows a local attacker to write beyond the boundary of a caller-supplied buffer when receiving network packets with ancillary data (control messages). The vulnerability stems from incomplete validation of buffer size before writing packet information metadata. An attacker with local user privileges can trigger this by receiving a specially crafted packet, potentially corrupting memory and gaining elevated permissions or crashing the system. The issue affects Zephyr versions 3.6.0 through 4.4.0.
Source data · NVD / CISA · public domain
- CVSS
- 3.1 · 8.7 HIGH · CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:L/I:H/A:H
- Weaknesses (CWE)
- CWE-787
- Affected products
- 1 configuration(s)
- Published / Modified
- 2026-06-28 / 2026-07-14
NVD description (verbatim)
Zephyr's IP socket recvmsg() implementation (subsys/net/lib/sockets/sockets_inet.c, insert_pktinfo()) validated the user-supplied ancillary (msg_control) buffer using only the payload length (msg->msg_controllen < pktinfo_len) 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 IP_PKTINFO 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 CONFIG_USERSPACE the recvmsg verifier allocates a kernel-heap copy of the control buffer sized to msg_controllen 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 IP_PKTINFO/IPV6_RECVPKTINFO (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 ipi_addr) is influenced by the received packet. The fix makes the capacity check use NET_CMSG_SPACE(pktinfo_len) (aligned header + aligned data) and returns -ENOMEM when the buffer is too small. Affected: v3.6.0 through v4.4.0.
2 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
CVE-2026-10643 is an out-of-bounds heap write in Zephyr's IP socket recvmsg() implementation, specifically in the insert_pktinfo() function within subsys/net/lib/sockets/sockets_inet.c. The vulnerability arises from a bounds check that validates only the payload length (msg_controllen < pktinfo_len) without accounting for the cmsg (control message) header alignment. On 64-bit systems, for IPv4 IP_PKTINFO, a control buffer of 16–27 bytes passes the validation but the function writes a complete 28-byte aligned structure, causing an overflow of up to ~12 bytes. Under CONFIG_USERSPACE, the kernel copies and processes the control buffer, leading to kernel heap corruption; in supervisor mode, the caller's stack or heap is overwritten. The exploitable path requires a UDP/IP socket with IP_PKTINFO, IPV6_RECVPKTINFO, or related socket options enabled, and is triggered when recvmsg() is called with an undersized control buffer coinciding with packet arrival. Partial bytes in the overflow (specifically the destination IP field, ipi_addr) are influenced by packet contents.
Business impact
This vulnerability poses a significant risk to Zephyr-based embedded systems and IoT devices. A local unprivileged process can corrupt kernel memory or adjacent application memory, leading to privilege escalation, denial of service, or information disclosure. In resource-constrained embedded deployments, kernel heap corruption may cascade into system instability. Organizations running Zephyr 3.6.0–4.4.0 in multi-tenant or multi-process environments face elevated risk; systems where untrusted local users or applications can create network sockets are directly threatened. Remediation requires timely patching to prevent exploitation in production deployments.
Affected systems
Zephyr RTOS versions 3.6.0 through 4.4.0 are affected. The vulnerability is triggered on systems where local unprivileged code can create UDP/IP sockets with IP_PKTINFO, IPV6_RECVPKTINFO, or equivalent socket options and receive network packets. Embedded devices, IoT platforms, and edge compute systems using the affected Zephyr release are at risk. The vulnerability requires local network access (ability to receive packets), so it is not directly exploitable over the internet but is a critical local privilege escalation vector.
Exploitability
Exploitability is high for local attackers with the ability to create network sockets. The attack does not require elevated privileges; a standard unprivileged user can trigger it by creating a UDP socket, enabling packet information ancillary data, calling recvmsg() with an intentionally small control buffer, and causing a packet to arrive. The timing is non-critical—any matching datagram reliably triggers the write. The overflow is deterministic in size and location, making reliable exploitation feasible. A motivated attacker with local access can use this to corrupt heap metadata, overwrite function pointers, or escalate to kernel-level code execution.
Remediation
Update Zephyr to a patched release version that corrects the bounds check in insert_pktinfo(). The fix modifies the capacity check to use NET_CMSG_SPACE(pktinfo_len), which includes both the aligned cmsg header and the aligned payload, and returns -ENOMEM when the buffer is insufficient. Consult the Zephyr release notes and security advisories to identify the first patched version after 4.4.0. Interim mitigation for unpatched systems includes disabling IP_PKTINFO and related ancillary data options on network sockets if the feature is not required by the application.
Patch guidance
Apply the latest Zephyr patch release that addresses this issue. Verify against the Zephyr security advisory and release notes (typically published after CVE assignment) to confirm the patched version number. Testing should validate that network functionality remains intact post-patch and that ancillary data is correctly handled with various control buffer sizes, including edge cases near the alignment boundary. For production deployments, conduct regression testing on representative hardware and network configurations before rolling out to devices.
Detection guidance
Monitor Zephyr deployments for use of IP_PKTINFO and IPV6_RECVPKTINFO socket options via code review and configuration audit. If the option is not required, disable it. On systems running Zephyr 3.6.0–4.4.0, watch for unexpected kernel panics, memory corruption events, or privilege escalation attempts from unprivileged processes. Kernel memory sanitizers (if available in your build) may catch the heap overflow. Network packet capture and analysis of received datagrams to suspiciously-small control buffers is difficult post-hoc but may assist incident response. Prioritize identifying and upgrading all affected Zephyr instances in your environment.
Why prioritize this
This is a HIGH-severity local privilege escalation with deterministic exploitability and measurable real-world impact. The CVSS 3.1 score of 8.7 reflects high impact on confidentiality, integrity, and availability, combined with low attack complexity and local-only attack vector. While not remotely exploitable, it is trivial for any unprivileged local user to trigger and can yield kernel-level code execution. Organizations with embedded or IoT systems running affected Zephyr versions should treat this as a critical priority; patching should commence immediately post-release availability.
Risk score, explained
CVSS 3.1 assigns a score of 8.7 (HIGH) using the vector CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:L/I:H/A:H. The Attack Vector (L) and low Attack Complexity reflect the straightforward local exploitation path. Privileged Require (L) indicates that unprivileged users can trigger the flaw. No User Interaction (N) means the attack is automatic upon packet receipt. The Scope Change (C) acknowledges that kernel-level memory corruption impacts system-wide security. High Integrity and Availability impact reflect the potential for privilege escalation and denial of service. Confidentiality impact is moderate because the overflow may leak adjacent heap contents.
Frequently asked questions
Can this vulnerability be exploited remotely?
No. The vulnerability requires local network packet receipt and creation of a local socket. An attacker must have local code execution or local network access to the affected device. Remote network attackers cannot directly trigger it; however, if local malware or an unprivileged app is already present, any network packet can be weaponized.
Do I need IP_PKTINFO enabled to be vulnerable?
Yes. The vulnerability is only triggered when a socket has IP_PKTINFO (IPv4) or IPV6_RECVPKTINFO (IPv6) ancillary data enabled and recvmsg() is called with an undersized control buffer. If your application does not use these socket options, the code path is not reached. Review your application configuration to determine if these features are in use.
What is the difference between CONFIG_USERSPACE and supervisor mode?
Under CONFIG_USERSPACE, the Zephyr kernel enforces memory protection and validates syscall parameters in a kernel copy, so the overflow corrupts kernel heap. In supervisor mode (single address space), the overflow corrupts the caller's buffer directly. Both scenarios are serious; kernel heap corruption enables privilege escalation.
Is there a workaround if I cannot patch immediately?
Disable IP_PKTINFO and IPV6_RECVPKTINFO socket options if they are not required by your application. Alternatively, ensure that any call to recvmsg() uses a control buffer sized to at least NET_CMSG_SPACE(sizeof(struct in_pktinfo)) or equivalent for your platform and socket type. However, patching is the definitive fix and should be prioritized.
This analysis is provided for informational purposes and represents a synthesis of publicly available information and vendor documentation. It is not a substitute for professional security assessment or vendor guidance. Organizations should verify all patch versions, compatibility, and testing requirements against official Zephyr release notes and security advisories before deployment. The vulnerability details and exploitability assessment are based on the CVE description and CVSS vector; actual impact may vary depending on system configuration, network isolation, and application design. SEC.co does not provide or endorse any exploit code or weaponized proof-of-concepts. Consult Zephyr's official security resources and your vendor for definitive remediation timelines and patch availability. Source: NVD (public-domain), retrieved 2026-08-06. Analysis generated by SEC.co (claude-haiku-4-5).
Related vulnerabilities
- CVE-2026-10641HIGHZephyr Bluetooth Classic HFP Out-of-Bounds Write Vulnerability
- CVE-2026-10658HIGHZephyr Bluetooth ISO Buffer Underflow Memory Corruption
- CVE-2026-5068HIGHZephyr Bluetooth L2CAP Out-of-Bounds Write – Remote DoS Risk
- CVE-2026-10644MEDIUMZephyr SERCOM-G1 UART Out-of-Bounds Write on PIC32CM-JH
- CVE-2026-5066MEDIUMZephyr TLS Session Cache Out-of-Bounds Write Vulnerability
- CVE-2026-5589MEDIUMInteger Underflow in Zephyr Bluetooth Mesh Solicitation Handling
- CVE-2020-9695HIGHAdobe Acrobat Reader Out-of-Bounds Write RCE Vulnerability
- CVE-2021-4478HIGHDräger CC-Vision Buffer Overflow in .gdt File Parsing