Impact
Zephyr's recvmsg() routine for IP sockets validates the user‑supplied ancillary (msg_control) buffer by comparing only its payload length (msg->msg_controllen < pktinfo_len) against the expected payload size, neglecting the size and alignment of the control message header. Because of this, a control buffer that is a few bytes smaller than required, for example 16–27 bytes on a 64‑bit platform where a single IP_PKTINFO record actually occupies 28 bytes, satisfies the test yet causes the kernel to write a full cmsg header and payload into that buffer. The write overflows up to roughly 12 bytes beyond the end of the supplied area, corrupting adjacent kernel‑heap memory when CONFIG_USERSPACE is enabled or corrupting the caller’s buffer in supervisor mode. Triggering the flaw requires a UDP or IPv6 socket with IP_PKTINFO/IPV6_RECVPKTINFO (or other ancillary options) enabled and a recvmsg() call with an undersized msg_control buffer while a datagram is received; part of the overwritten data (the destination IP in ipi_addr) reflects the contents of the received packet.
Affected Systems
Zephyr Project Zephyr OS is affected from v3.6.0 through v4.4.0. These releases contain the buggy insert_pktinfo() implementation that performs the undersized buffer validation.
Risk and Exploitability
The CVSS score of 8.7 classifies this as a high‑severity vulnerability. The EPSS score is low, at < 1%, and the issue is not listed in the CISA KEV catalog, but the attack vector is reachable via any UDP or IPv6 socket that has IP_PKTINFO/IPV6_RECVPKTINFO enabled. An unprivileged userspace thread can trigger the overflow by performing a recvmsg() call with an undersized control buffer while a datagram is received, leading to kernel heap corruption that could be leveraged for privilege escalation or arbitrary code execution.
OpenCVE Enrichment