CVE-2026-31700: net/packet: fix TOCTOU race on mmap'd vnet_hdr in tpacket_snd()
In the Linux kernel, the following vulnerability has been resolved:
net/packet: fix TOCTOU race on mmap'd vnethdr in tpacketsnd()
In tpacketsnd(), when PACKETVNETHDR is enabled, vnethdr points directly into the mmap'd TX ring buffer shared with userspace. The kernel validates the header via packetsndvnetparse() but then re-reads all fields later in virtionethdrtoskb(). A concurrent userspace thread can modify the vnethdr fields between validation and use, bypassing all safety checks.
The non-TPACKET path (packetsnd()) already correctly copies vnethdr to a stack-local variable. All other vnethdr consumers in the kernel (tun.c, tap.c, virtionet.c) also use stack copies. The TPACKET TX path is the only caller of virtionethdrtoskb() that reads directly from user-controlled shared memory.
Fix this by copying vnethdr from the mmap'd ring buffer to a stack-local variable before validation and use, consistent with the approach used in packetsnd() and all other callers.
Affected Software
Event History
Frequently Asked Questions
What is the severity of CVE-2026-31700?
CVE-2026-31700 has a severity rating that indicates it poses a significant risk due to a TOCTOU race condition in the Linux kernel.
What systems are affected by CVE-2026-31700?
CVE-2026-31700 affects the Linux kernel, particularly when PACKET_VNET_HDR is enabled.
How do I fix CVE-2026-31700?
To fix CVE-2026-31700, it is recommended to apply the latest patches available for your Linux kernel version.
When was CVE-2026-31700 reported?
CVE-2026-31700 was reported as part of a set of vulnerabilities that were addressed in the Linux kernel.
What is the impact of CVE-2026-31700?
The impact of CVE-2026-31700 can lead to integrity issues in the transmission of packets due to race conditions.