CVE-2026-31700
Received Received - Intake
Race Condition in Linux Kernel Packet Socket

Publication date: 2026-05-01

Last updated on: 2026-05-06

Assigner: kernel.org

Description
In the Linux kernel, the following vulnerability has been resolved: net/packet: fix TOCTOU race on mmap'd vnet_hdr in tpacket_snd() In tpacket_snd(), when PACKET_VNET_HDR is enabled, vnet_hdr points directly into the mmap'd TX ring buffer shared with userspace. The kernel validates the header via __packet_snd_vnet_parse() but then re-reads all fields later in virtio_net_hdr_to_skb(). A concurrent userspace thread can modify the vnet_hdr fields between validation and use, bypassing all safety checks. The non-TPACKET path (packet_snd()) already correctly copies vnet_hdr to a stack-local variable. All other vnet_hdr consumers in the kernel (tun.c, tap.c, virtio_net.c) also use stack copies. The TPACKET TX path is the only caller of virtio_net_hdr_to_skb() that reads directly from user-controlled shared memory. Fix this by copying vnet_hdr from the mmap'd ring buffer to a stack-local variable before validation and use, consistent with the approach used in packet_snd() and all other callers.
CVSS Scores
EPSS Scores
Probability:
Percentile:
Meta Information
Published
2026-05-01
Last Modified
2026-05-06
Generated
2026-05-06
AI Q&A
2026-05-01
EPSS Evaluated
2026-05-05
NVD
EUVD
Affected Vendors & Products
Showing 6 associated CPEs
Vendor Product Version / Range
linux linux_kernel From 6.7 (inc) to 6.12.84 (exc)
linux linux_kernel From 4.6 (inc) to 6.6.136 (exc)
linux linux_kernel 7.1
linux linux_kernel 7.1
linux linux_kernel From 6.13 (inc) to 6.18.25 (exc)
linux linux_kernel From 6.19 (inc) to 7.0.2 (exc)
Helpful Resources
Exploitability
CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-362 The product contains a concurrent code sequence that requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence operating concurrently.
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?

This vulnerability exists in the Linux kernel's network packet sending function tpacket_snd() when the PACKET_VNET_HDR feature is enabled. The issue is a time-of-check to time-of-use (TOCTOU) race condition involving the vnet_hdr structure, which points directly into a memory-mapped transmit ring buffer shared with userspace.

The kernel first validates the vnet_hdr fields but then re-reads them later from the shared memory without copying them to a safe location. Because userspace can concurrently modify these fields between validation and use, it can bypass the kernel's safety checks.

The fix involves copying the vnet_hdr data from the shared mmap buffer to a stack-local variable before validation and use, preventing userspace from modifying the data during processing and thus eliminating the race condition.


How can this vulnerability impact me? :

This vulnerability can allow a malicious userspace process to manipulate network packet headers after the kernel has validated them but before they are used, potentially bypassing security checks.

Such manipulation could lead to unexpected behavior in packet processing, possibly enabling privilege escalation, data corruption, or network attacks by injecting malformed or unauthorized packets.


What immediate steps should I take to mitigate this vulnerability?

The vulnerability is fixed by updating the Linux kernel to a version where the TOCTOU race condition in tpacket_snd() is resolved.

Specifically, the fix involves copying the vnet_hdr from the mmap'd ring buffer to a stack-local variable before validation and use, preventing concurrent userspace modifications from bypassing safety checks.

Therefore, the immediate mitigation step is to apply the kernel update that includes this fix.


Ask Our AI Assistant
Need more information? Ask your question to get an AI reply (Powered by our expertise)
0/70
EPSS Chart