l2tp: Drop large packets with UDP encap
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 3557baabf28088f49bdf72a048fd33ab62e205b1 · < 86534c97abd6365a9a021fd767a2023e63c44469| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
l2tp: Drop large packets with UDP encap
syzbot reported a WARN on my patch series [1]. The actual issue is an overflow of 16-bit UDP length field, and it exists in the upstream code. My series added a debug WARN with an overflow check that exposed the issue, that's why syzbot tripped on my patches, rather than on upstream code.
syzbot's repro:
r0 = socket$pppl2tp(0x18, 0x1, 0x1) r1 = socket$inet6_udp(0xa, 0x2, 0x0) connect$inet6(r1, &(0x7f00000000c0)={0xa, 0x0, 0x0, @loopback, 0xfffffffc}, 0x1c) connect$pppl2tp(r0, &(0x7f0000000240)=@pppol2tpin6={0x18, 0x1, {0x0, r1, 0x4, 0x0, 0x0, 0x0, {0xa, 0x4e22, 0xffff, @ipv4={'\x00', '\xff\xff', @empty}}}}, 0x32) writev(r0, &(0x7f0000000080)=[{&(0x7f0000000000)="ee", 0x34000}], 0x1)
It basically sends an oversized (0x34000 bytes) PPPoL2TP packet with UDP encapsulation, and l2tp_xmit_core doesn't check for overflows when it assigns the UDP length field. The value gets trimmed to 16 bites.
Add an overflow check that drops oversized packets and avoids sending packets with trimmed UDP length to the wire.
syzbot's stack trace (with my patch applied):
From the CVE record · Linux
The Linux kernel’s L2TP transmit path does not check whether a UDP-encapsulated packet is too large for the 16-bit UDP length field. A local sender able to send an oversized PPPoL2TP packet can cause the length to be truncated, resulting in a packet with an incorrect UDP length being sent. The input does not specify authentication requirements beyond the ability to send the packet.
Engineers running Linux kernels with L2TP support should check their kernel; affected versions are not specified.