Linux kernel
cpe:2.3:a:linux:linux_kernel:*:*:*:*:*:*:*, +4 more
A time-of-check to time-of-use (TOCTOU) race condition vulnerability has been identified in the Linux kernel's TPACKET transmission path. When the PACKET_VNET_HDR option is enabled, the virtual network header (vnet_hdr) is mapped directly to the user-space shared memory of the transmit (TX) ring buffer. The kernel initially validates this header but subsequently re-reads the fields from the shared memory, creating a window where a concurrent user-space thread could alter the header information, bypassing safety checks. This issue is unique to the TPACKET TX path, as other components that use vnet_hdr rely on stack copies, not direct memory mappings.
Exploitation of this vulnerability allows for a TOCTOU race condition, where a user-space thread can manipulate the vnet_hdr fields between validation and usage, potentially leading to unintended behavior in packet transmission.
The vulnerability can be reproduced by enabling PACKET_VNET_HDR and sending packets through a TPACKET socket while concurrently modifying the vnet_hdr fields in the user-space application. This can be done by creating a race condition between the packet validation and the subsequent processing, taking advantage of the direct memory mapping from the user-space to the kernel.
The vulnerability has been fixed by modifying the TPACKET transmission function to copy the virtual network header from the mmap'd ring buffer to a local stack variable before validation and use. Users should update to the latest version of the Linux kernel where this fix has been applied.
Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.