Skip to content

CVE-2024-49949 net: avoid potential underflow in qdisc_pkt_len_init() with UFO

MediumCVSS 5.5 EPSS 0.28%
Published
Updated
Exploit status
No public exploit known
CISA SSVC
No known exploitation · automatable: no · technical impact: partial
Technology
Linux KernelUbuntuDebian

Description

In the Linux kernel, the following vulnerability has been resolved:

net: avoid potential underflow in qdisc_pkt_len_init() with UFO

After commit 7c6d2ecbda83 ("net: be more gentle about silly gso
requests coming from user") virtio_net_hdr_to_skb() had sanity check
to detect malicious attempts from user space to cook a bad GSO packet.

Then commit cf9acc90c80ec ("net: virtio_net_hdr_to_skb: count
transport header in UFO") while fixing one issue, allowed user space
to cook a GSO packet with the following characteristic :

IPv4 SKB_GSO_UDP, gso_size=3, skb->len = 28.

When this packet arrives in qdisc_pkt_len_init(), we end up
with hdr_len = 28 (IPv4 header + UDP header), matching skb->len

Then the following sets gso_segs to 0 :

gso_segs = DIV_ROUND_UP(skb->len - hdr_len,
shinfo->gso_size);

Then later we set qdisc_skb_cb(skb)->pkt_len to back to zero :/

qdisc_skb_cb(skb)->pkt_len += (gso_segs - 1) * hdr_len;

This leads to the following crash in fq_codel [1]

qdisc_pkt_len_init() is best effort, we only want an estimation
of the bytes sent on the wire, not crashing the kernel.

This patch is fixing this particular issue, a following one
adds more sanity checks for another potential bug.

[1]
[ 70.724101] BUG: kernel NULL pointer dereference, address: 0000000000000000
[ 70.724561] #PF: supervisor read access in kernel mode
[ 70.724561] #PF: error_code(0x0000) - not-present page
[ 70.724561] PGD 10ac61067 P4D 10ac61067 PUD 107ee2067 PMD 0
[ 70.724561] Oops: Oops: 0000 [#1] SMP NOPTI
[ 70.724561] CPU: 11 UID: 0 PID: 2163 Comm: b358537762 Not tainted 6.11.0-virtme #991
[ 70.724561] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[ 70.724561] RIP: 0010:fq_codel_enqueue (net/sched/sch_fq_codel.c:120 net/sched/sch_fq_codel.c:168 net/sched/sch_fq_codel.c:230) sch_fq_codel
[ 70.724561] Code: 24 08 49 c1 e1 06 44 89 7c 24 18 45 31 ed 45 31 c0 31 ff 89 44 24 14 4c 03 8b 90 01 00 00 eb 04 39 ca 73 37 4d 8b 39 83 c7 01 <49> 8b 17 49 89 11 41 8b 57 28 45 8b 5f 34 49 c7 07 00 00 00 00 49
All code

0: 24 08 and $0x8,%al
2: 49 c1 e1 06 shl $0x6,%r9
6: 44 89 7c 24 18 mov %r15d,0x18(%rsp)
b: 45 31 ed xor %r13d,%r13d
e: 45 31 c0 xor %r8d,%r8d
11: 31 ff xor %edi,%edi
13: 89 44 24 14 mov %eax,0x14(%rsp)
17: 4c 03 8b 90 01 00 00 add 0x190(%rbx),%r9
1e: eb 04 jmp 0x24
20: 39 ca cmp %ecx,%edx
22: 73 37 jae 0x5b
24: 4d 8b 39 mov (%r9),%r15
27: 83 c7 01 add $0x1,%edi
2a:* 49 8b 17 mov (%r15),%rdx <-- trapping instruction
2d: 49 89 11 mov %rdx,(%r9)
30: 41 8b 57 28 mov 0x28(%r15),%edx
34: 45 8b 5f 34 mov 0x34(%r15),%r11d
38: 49 c7 07 00 00 00 00 movq $0x0,(%r15)
3f: 49 rex.WB

Code starting with the faulting instruction

0: 49 8b 17 mov (%r15),%rdx
3: 49 89 11 mov %rdx,(%r9)
6: 41 8b 57 28 mov 0x28(%r15),%edx
a: 45 8b 5f 34 mov 0x34(%r15),%r11d
e: 49 c7 07 00 00 00 00 movq $0x0,(%r15)
15: 49 rex.WB
[ 70.724561] RSP: 0018:ffff95ae85e6fb90 EFLAGS: 00000202
[ 70.724561] RAX: 0000000002000000 RBX: ffff95ae841de000 RCX: 0000000000000000
[ 70.724561] RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000001
[ 70.724561] RBP: ffff95ae85e6fbf8 R08: 0000000000000000 R09: ffff95b710a30000
[ 70.724561] R10: 0000000000000000 R11: bdf289445ce31881 R12: ffff95ae85e6fc58
[ 70.724561] R13: 0000000000000000 R14: 0000000000000040 R15: 0000000000000000
[ 70.724561] FS: 000000002c5c1380(0000) GS:ffff95bd7fcc0000(0000) knlGS:0000000000000000
[ 70.724561] CS: 0010 DS: 0000 ES: 0000 C
---truncated---

Upgrade path

17 packages: 17 fixed.

PackageAffectedFixed inStatus
debian/linux(Debian 12) < 6.1.115-1; = 6.1.27-1; = 6.1.37-1; = 6.1.38-1 +27 more 6.1.115-1 Fixed
debian/linux(Debian 13) < 6.11.4-1 6.11.4-1 Fixed
debian/linux(Debian 14) < 6.11.4-1 6.11.4-1 Fixed
Linux kernel < 4.19.323; < 5.4.285; < 5.10.227; < 5.15.168 +29 more 4.15, 4.19, 4.19.323, 5.4, 5.4.285, 5.10, 5.10.227, 5.15.168, 6.1.113, 6.6.55, 6.10.14, 6.11.3, 6.12, 25ab0b87dbd89cecef8a9c60a02bb97832e471d1, 81fd007dcd47c34471766249853e4d4bce8eea4b, 939c88cbdc668dadd8cfa7a35d9066331239041c, 1598d70ad9c7d0a4d9d54b82094e9f45908fda6d, ba26060a29d3ca1bfc737aa79f7125128f35147c, c20029db28399ecc50e556964eaba75c43b1e2f1, d70ca7598943572d5e384227bd268acb5109bf72, d6114993e0a89fde84a60a60a8329a571580b174, f959cce8a2a04ce776aa8b78e83ce339e0d7fbac Fixed
Microsoft cbl mariner < 5.15.173.1-1 5.15.173.1-1 Fixed
Siemens RUGGEDCOM RST2428P < V3.2 V3.2 Fixed
Siemens SCALANCE XC-300/XR-300/XC-400/XR-500WG/XR-500 family < V3.2 V3.2 Fixed
Siemens SCALANCE XCM-/XRM-/XCH-/XRH-300 family < V3.2 V3.2 Fixed
Siemens SIMATIC S7-1500 CPU 1518-4 PN/DP MFP >= V3.1.0, < V3.1.5 V3.1.5 Fixed
Siemens SIMATIC S7-1500 CPU 1518F-4 PN/DP MFP >= V3.1.0, < V3.1.5 V3.1.5 Fixed
Siemens SIMATIC S7-1500 TM MFP - GNU/Linux subsystem < V1.1.1 V1.1.1 Fixed
Siemens SIPLUS S7-1500 CPU 1518-4 PN/DP MFP >= V3.1.0, < V3.1.5 V3.1.5 Fixed
ubuntu/linux(Ubuntu 22.04) < 5.15.0-127.137 5.15.0-127.137 Fixed
ubuntu/linux(Ubuntu 24.04) < 6.8.0-54.56 6.8.0-54.56 Fixed
ubuntu/linux-kvm(Ubuntu 22.04) < 5.15.0-1070.75 5.15.0-1070.75 Fixed
ubuntu/linux-raspi(Ubuntu 22.04) < 5.15.0-1066.69 5.15.0-1066.69 Fixed
ubuntu/linux-raspi(Ubuntu 24.04) < 6.8.0-1019.23 6.8.0-1019.23 Fixed

Affected products

ProductAffected versionsFixed in
Microsoft cbl mariner < 5.15.173.1-1 5.15.173.1-1
debian/linux(Debian:12) < 6.1.115-1 6.1.115-1
debian/linux(Debian:12) = 6.1.106-1 No fix listed
debian/linux(Debian:12) = 6.1.106-2 No fix listed
debian/linux(Debian:12) = 6.1.106-3 No fix listed
debian/linux(Debian:12) = 6.1.112-1 No fix listed
debian/linux(Debian:12) = 6.1.27-1 No fix listed
debian/linux(Debian:12) = 6.1.37-1 No fix listed
debian/linux(Debian:12) = 6.1.38-1 No fix listed
debian/linux(Debian:12) = 6.1.38-2 No fix listed
debian/linux(Debian:12) = 6.1.38-2~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.38-3 No fix listed
debian/linux(Debian:12) = 6.1.38-4 No fix listed
debian/linux(Debian:12) = 6.1.38-4~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.52-1 No fix listed
debian/linux(Debian:12) = 6.1.55-1 No fix listed
debian/linux(Debian:12) = 6.1.55-1~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.64-1 No fix listed
debian/linux(Debian:12) = 6.1.66-1 No fix listed
debian/linux(Debian:12) = 6.1.67-1 No fix listed
debian/linux(Debian:12) = 6.1.69-1 No fix listed
debian/linux(Debian:12) = 6.1.69-1~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.76-1 No fix listed
debian/linux(Debian:12) = 6.1.76-1~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.82-1 No fix listed
Show 54 more
ProductAffected versionsFixed in
debian/linux(Debian:12) = 6.1.85-1 No fix listed
debian/linux(Debian:12) = 6.1.90-1 No fix listed
debian/linux(Debian:12) = 6.1.90-1~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.94-1 No fix listed
debian/linux(Debian:12) = 6.1.94-1~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.98-1 No fix listed
debian/linux(Debian:12) = 6.1.99-1 No fix listed
debian/linux(Debian:13) < 6.11.4-1 6.11.4-1
debian/linux(Debian:14) < 6.11.4-1 6.11.4-1
ubuntu/linux(Ubuntu:22.04) < 5.15.0-127.137 5.15.0-127.137
ubuntu/linux-kvm(Ubuntu:22.04) < 5.15.0-1070.75 5.15.0-1070.75
ubuntu/linux-raspi(Ubuntu:22.04) < 5.15.0-1066.69 5.15.0-1066.69
Linux kernel >= 960b360ca7463921c1a6b72e7066a706d6406223, < d70ca7598943572d5e384227bd268acb5109bf72 d70ca7598943572d5e384227bd268acb5109bf72
Linux kernel >= fb2dbc124a7f800cd0e4f901a1bbb769a017104c, < 1598d70ad9c7d0a4d9d54b82094e9f45908fda6d 1598d70ad9c7d0a4d9d54b82094e9f45908fda6d
Linux kernel >= 8e6bae950da9dc2d2c6c18b1c6b206dc00dc8772, < ba26060a29d3ca1bfc737aa79f7125128f35147c ba26060a29d3ca1bfc737aa79f7125128f35147c
Linux kernel >= 0f810d06b507aa40fef8d1ac0a88e6d0590dbfc3, < 939c88cbdc668dadd8cfa7a35d9066331239041c 939c88cbdc668dadd8cfa7a35d9066331239041c
Linux kernel >= cf9acc90c80ecbee00334aa85d92f4e74014bcff, < d6114993e0a89fde84a60a60a8329a571580b174 d6114993e0a89fde84a60a60a8329a571580b174
Linux kernel >= cf9acc90c80ecbee00334aa85d92f4e74014bcff, < 25ab0b87dbd89cecef8a9c60a02bb97832e471d1 25ab0b87dbd89cecef8a9c60a02bb97832e471d1
Linux kernel >= cf9acc90c80ecbee00334aa85d92f4e74014bcff, < f959cce8a2a04ce776aa8b78e83ce339e0d7fbac f959cce8a2a04ce776aa8b78e83ce339e0d7fbac
Linux kernel >= cf9acc90c80ecbee00334aa85d92f4e74014bcff, < 81fd007dcd47c34471766249853e4d4bce8eea4b 81fd007dcd47c34471766249853e4d4bce8eea4b
Linux kernel >= cf9acc90c80ecbee00334aa85d92f4e74014bcff, < c20029db28399ecc50e556964eaba75c43b1e2f1 c20029db28399ecc50e556964eaba75c43b1e2f1
Linux kernel = 2128303bff700c857739a0af8cc39c1a41840650 No fix listed
Linux kernel >= 4.19.218, < 4.19.323 4.19.323
Linux kernel >= 5.4.162, < 5.4.285 5.4.285
Linux kernel >= 5.10.82, < 5.10.227 5.10.227
Linux kernel >= 5.15.5, < 5.15.168 5.15.168
Linux kernel >= 4.14.256, < 4.15 4.15
Linux kernel = 5.16 No fix listed
Linux kernel < 4.19.323 4.19.323
Linux kernel < 5.4.285 5.4.285
Linux kernel < 5.10.227 5.10.227
Linux kernel < 5.15.168 5.15.168
Linux kernel < 6.1.113 6.1.113
Linux kernel < 6.6.55 6.6.55
Linux kernel < 6.10.14 6.10.14
Linux kernel < 6.11.3 6.11.3
Linux kernel < 6.12 6.12
Siemens SIMATIC S7-1500 CPU 1518-4 PN/DP MFP >= V3.1.0, < V3.1.5 V3.1.5
Siemens SIMATIC S7-1500 CPU 1518F-4 PN/DP MFP >= V3.1.0, < V3.1.5 V3.1.5
Siemens SIMATIC S7-1500 TM MFP - GNU/Linux subsystem < V1.1.1 V1.1.1
Siemens SIPLUS S7-1500 CPU 1518-4 PN/DP MFP >= V3.1.0, < V3.1.5 V3.1.5
Siemens RUGGEDCOM RST2428P < V3.2 V3.2
Siemens SCALANCE XC-300/XR-300/XC-400/XR-500WG/XR-500 family < V3.2 V3.2
Siemens SCALANCE XCM-/XRM-/XCH-/XRH-300 family < V3.2 V3.2
ubuntu/linux(Ubuntu:24.04) < 6.8.0-54.56 6.8.0-54.56
ubuntu/linux-raspi(Ubuntu:24.04) < 6.8.0-1019.23 6.8.0-1019.23
Linux kernel >= 4.14.256, < 4.19 4.19
Linux kernel >= 4.19.218, < 5.4 5.4
Linux kernel >= 5.4.162, < 5.10 5.10
Linux kernel >= 5.16, < 6.1.113 6.1.113
Linux kernel >= 6.2, < 6.6.55 6.6.55
Linux kernel >= 6.7, < 6.10.14 6.10.14
Linux kernel >= 6.11, < 6.11.3 6.11.3
Linux kernel = 6.12-rc1 No fix listed

References