af_packet: Don't cast tpacket_hdr.tp_len to int in tpacket_parse_header().
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 69e3c75f4d541a6eb151b3ef91f34033cb3ad6e1 · < 72abe77e88c3f1f71c5348124e9b28e285f26950| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
af_packet: Don't cast tpacket_hdr.tp_len to int in tpacket_parse_header().
syzbot reported BUG() in sock_sendmsg_nosec(). [0]
The problem is that tpacket_parse_header() casts user-provided tpacket_hdr.tp_len, which is u32, to int.
If the length is larger than INT_MAX, the following condition in tpacket_parse_header() passes,
if (unlikely(tp_len > size_max))
and any negative value can be returned to the caller, up to sock_sendmsg_nosec().
The repro set tpacket_hdr.tp_len to 0xfffffdef, which is cast to -EIOCBQUEUED (-529), triggering BUG() in sock_sendmsg_nosec().
From the CVE record · Linux
The Linux kernel's af_packet header parser casts a user-provided packet length to a signed integer. A local caller supplying a crafted length can trigger a kernel BUG() during a socket write. The input does not specify authentication requirements or any separate user interaction.
Engineers running Linux kernels should check their exposure; affected versions are not specified.