CVE-2026-31700

net/packet: fix TOCTOU race on mmap'd vnet_hdr in tpacket_snd()

State
Published
Severity
7.8 High
Published
May 1, 2026
Updated
Oct 19, 2026
Reserved
Mar 9, 2026

Read the record on cve.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.

Scores

CVSSScoreVectorSource
3.17.8 HighCVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:HLinux

Weaknesses

  • CWE-367 Time-of-check Time-of-use (TOCTOU) Race Condition

Affected Products

ProductVersions
LinuxLinux
  • 1d036d25e5609ba73fee6a88db01c306b140d512 to before 0f4c9754956b86de158a4af5278c5cf5bda9439eAffected
  • 1d036d25e5609ba73fee6a88db01c306b140d512 to before 714aa973da8163925eda7efd49361ccbee21ee46Affected
  • 1d036d25e5609ba73fee6a88db01c306b140d512 to before 1490f82353bdabc09265a74e645b07f05cf4188eAffected
  • 1d036d25e5609ba73fee6a88db01c306b140d512 to before 74e2db36fe50e3ad9d5300d7fd0e6e2a15a6d121Affected
  • 1d036d25e5609ba73fee6a88db01c306b140d512 to before 3a1bf9116ea31470b89692585c3910dfe830dcddAffected
  • 1d036d25e5609ba73fee6a88db01c306b140d512 to before 28324a3b62d9ce7f9bdd65a8ce63f382041d1b27Affected
  • 1d036d25e5609ba73fee6a88db01c306b140d512 to before 48a6ef291a17639e1b6ae0fbe9c8b2bb87d7804bAffected
  • 1d036d25e5609ba73fee6a88db01c306b140d512 to before 2c054e17d9d41f1020376806c7f750834ced4dc5Affected
LinuxLinux
  • 4.6Affected
  • before 4.6Not affected
  • 5.10.259 through 5.10.*Not affected
  • 5.15.210 through 5.15.*Not affected
  • 6.1.176 through 6.1.*Not affected
  • 6.6.136 through 6.6.*Not affected
  • 6.12.84 through 6.12.*Not affected
  • 6.18.25 through 6.18.*Not affected
  • 7.0.2 through 7.0.*Not affected
  • 7.1 and laterNot affected

References

Every record here comes from the CVE Program’s CVE List. © 1999–2026 The MITRE Corporation. CVE is a registered trademark of The MITRE Corporation. The records are reproduced under the CVE Program terms of use.