CVE-2021-46955

Severity CVSS v4.0:
Pending analysis
Type:
CWE-125 Out-of-bounds Read
Publication date:
27/02/2024
Last modified:
06/12/2024

Description

In the Linux kernel, the following vulnerability has been resolved:<br /> <br /> openvswitch: fix stack OOB read while fragmenting IPv4 packets<br /> <br /> running openvswitch on kernels built with KASAN, it&amp;#39;s possible to see the<br /> following splat while testing fragmentation of IPv4 packets:<br /> <br /> BUG: KASAN: stack-out-of-bounds in ip_do_fragment+0x1b03/0x1f60<br /> Read of size 1 at addr ffff888112fc713c by task handler2/1367<br /> <br /> CPU: 0 PID: 1367 Comm: handler2 Not tainted 5.12.0-rc6+ #418<br /> Hardware name: Red Hat KVM, BIOS 1.11.1-4.module+el8.1.0+4066+0f1aadab 04/01/2014<br /> Call Trace:<br /> dump_stack+0x92/0xc1<br /> print_address_description.constprop.7+0x1a/0x150<br /> kasan_report.cold.13+0x7f/0x111<br /> ip_do_fragment+0x1b03/0x1f60<br /> ovs_fragment+0x5bf/0x840 [openvswitch]<br /> do_execute_actions+0x1bd5/0x2400 [openvswitch]<br /> ovs_execute_actions+0xc8/0x3d0 [openvswitch]<br /> ovs_packet_cmd_execute+0xa39/0x1150 [openvswitch]<br /> genl_family_rcv_msg_doit.isra.15+0x227/0x2d0<br /> genl_rcv_msg+0x287/0x490<br /> netlink_rcv_skb+0x120/0x380<br /> genl_rcv+0x24/0x40<br /> netlink_unicast+0x439/0x630<br /> netlink_sendmsg+0x719/0xbf0<br /> sock_sendmsg+0xe2/0x110<br /> ____sys_sendmsg+0x5ba/0x890<br /> ___sys_sendmsg+0xe9/0x160<br /> __sys_sendmsg+0xd3/0x170<br /> do_syscall_64+0x33/0x40<br /> entry_SYSCALL_64_after_hwframe+0x44/0xae<br /> RIP: 0033:0x7f957079db07<br /> Code: c3 66 90 41 54 41 89 d4 55 48 89 f5 53 89 fb 48 83 ec 10 e8 eb ec ff ff 44 89 e2 48 89 ee 89 df 41 89 c0 b8 2e 00 00 00 0f 05 3d 00 f0 ff ff 77 35 44 89 c7 48 89 44 24 08 e8 24 ed ff ff 48<br /> RSP: 002b:00007f956ce35a50 EFLAGS: 00000293 ORIG_RAX: 000000000000002e<br /> RAX: ffffffffffffffda RBX: 0000000000000019 RCX: 00007f957079db07<br /> RDX: 0000000000000000 RSI: 00007f956ce35ae0 RDI: 0000000000000019<br /> RBP: 00007f956ce35ae0 R08: 0000000000000000 R09: 00007f9558006730<br /> R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000000<br /> R13: 00007f956ce37308 R14: 00007f956ce35f80 R15: 00007f956ce35ae0<br /> <br /> The buggy address belongs to the page:<br /> page:00000000af2a1d93 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x112fc7<br /> flags: 0x17ffffc0000000()<br /> raw: 0017ffffc0000000 0000000000000000 dead000000000122 0000000000000000<br /> raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000<br /> page dumped because: kasan: bad access detected<br /> <br /> addr ffff888112fc713c is located in stack of task handler2/1367 at offset 180 in frame:<br /> ovs_fragment+0x0/0x840 [openvswitch]<br /> <br /> this frame has 2 objects:<br /> [32, 144) &amp;#39;ovs_dst&amp;#39;<br /> [192, 424) &amp;#39;ovs_rt&amp;#39;<br /> <br /> Memory state around the buggy address:<br /> ffff888112fc7000: f3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00<br /> ffff888112fc7080: 00 f1 f1 f1 f1 00 00 00 00 00 00 00 00 00 00 00<br /> &gt;ffff888112fc7100: 00 00 00 f2 f2 f2 f2 f2 f2 00 00 00 00 00 00 00<br /> ^<br /> ffff888112fc7180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00<br /> ffff888112fc7200: 00 00 00 00 00 00 f2 f2 f2 00 00 00 00 00 00 00<br /> <br /> for IPv4 packets, ovs_fragment() uses a temporary struct dst_entry. Then,<br /> in the following call graph:<br /> <br /> ip_do_fragment()<br /> ip_skb_dst_mtu()<br /> ip_dst_mtu_maybe_forward()<br /> ip_mtu_locked()<br /> <br /> the pointer to struct dst_entry is used as pointer to struct rtable: this<br /> turns the access to struct members like rt_mtu_locked into an OOB read in<br /> the stack. Fix this changing the temporary variable used for IPv4 packets<br /> in ovs_fragment(), similarly to what is done for IPv6 few lines below.

Vulnerable products and versions

CPE From Up to
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 4.4.134 (including) 4.4.269 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 4.9.104 (including) 4.9.269 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 4.14.45 (including) 4.14.233 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 4.16 (including) 4.19.191 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 4.20 (including) 5.4.118 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 5.5 (including) 5.10.36 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 5.11 (including) 5.11.20 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 5.12 (including) 5.12.3 (excluding)