CVE-2024-47711
Severity CVSS v4.0:
Pending analysis
Type:
CWE-416
Use After Free
Publication date:
21/10/2024
Last modified:
24/10/2024
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
af_unix: Don&#39;t return OOB skb in manage_oob().<br />
<br />
syzbot reported use-after-free in unix_stream_recv_urg(). [0]<br />
<br />
The scenario is<br />
<br />
1. send(MSG_OOB)<br />
2. recv(MSG_OOB)<br />
-> The consumed OOB remains in recv queue<br />
3. send(MSG_OOB)<br />
4. recv()<br />
-> manage_oob() returns the next skb of the consumed OOB<br />
-> This is also OOB, but unix_sk(sk)->oob_skb is not cleared<br />
5. recv(MSG_OOB)<br />
-> unix_sk(sk)->oob_skb is used but already freed<br />
<br />
The recent commit 8594d9b85c07 ("af_unix: Don&#39;t call skb_get() for OOB<br />
skb.") uncovered the issue.<br />
<br />
If the OOB skb is consumed and the next skb is peeked in manage_oob(),<br />
we still need to check if the skb is OOB.<br />
<br />
Let&#39;s do so by falling back to the following checks in manage_oob()<br />
and add the test case in selftest.<br />
<br />
Note that we need to add a similar check for SIOCATMARK.<br />
<br />
[0]:<br />
BUG: KASAN: slab-use-after-free in unix_stream_read_actor+0xa6/0xb0 net/unix/af_unix.c:2959<br />
Read of size 4 at addr ffff8880326abcc4 by task syz-executor178/5235<br />
<br />
CPU: 0 UID: 0 PID: 5235 Comm: syz-executor178 Not tainted 6.11.0-rc5-syzkaller-00742-gfbdaffe41adc #0<br />
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024<br />
Call Trace:<br />
<br />
__dump_stack lib/dump_stack.c:93 [inline]<br />
dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119<br />
print_address_description mm/kasan/report.c:377 [inline]<br />
print_report+0x169/0x550 mm/kasan/report.c:488<br />
kasan_report+0x143/0x180 mm/kasan/report.c:601<br />
unix_stream_read_actor+0xa6/0xb0 net/unix/af_unix.c:2959<br />
unix_stream_recv_urg+0x1df/0x320 net/unix/af_unix.c:2640<br />
unix_stream_read_generic+0x2456/0x2520 net/unix/af_unix.c:2778<br />
unix_stream_recvmsg+0x22b/0x2c0 net/unix/af_unix.c:2996<br />
sock_recvmsg_nosec net/socket.c:1046 [inline]<br />
sock_recvmsg+0x22f/0x280 net/socket.c:1068<br />
____sys_recvmsg+0x1db/0x470 net/socket.c:2816<br />
___sys_recvmsg net/socket.c:2858 [inline]<br />
__sys_recvmsg+0x2f0/0x3e0 net/socket.c:2888<br />
do_syscall_x64 arch/x86/entry/common.c:52 [inline]<br />
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83<br />
entry_SYSCALL_64_after_hwframe+0x77/0x7f<br />
RIP: 0033:0x7f5360d6b4e9<br />
Code: 48 83 c4 28 c3 e8 37 17 00 00 0f 1f 80 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48<br />
RSP: 002b:00007fff29b3a458 EFLAGS: 00000246 ORIG_RAX: 000000000000002f<br />
RAX: ffffffffffffffda RBX: 00007fff29b3a638 RCX: 00007f5360d6b4e9<br />
RDX: 0000000000002001 RSI: 0000000020000640 RDI: 0000000000000003<br />
RBP: 00007f5360dde610 R08: 0000000000000000 R09: 0000000000000000<br />
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001<br />
R13: 00007fff29b3a628 R14: 0000000000000001 R15: 0000000000000001<br />
<br />
<br />
Allocated by task 5235:<br />
kasan_save_stack mm/kasan/common.c:47 [inline]<br />
kasan_save_track+0x3f/0x80 mm/kasan/common.c:68<br />
unpoison_slab_object mm/kasan/common.c:312 [inline]<br />
__kasan_slab_alloc+0x66/0x80 mm/kasan/common.c:338<br />
kasan_slab_alloc include/linux/kasan.h:201 [inline]<br />
slab_post_alloc_hook mm/slub.c:3988 [inline]<br />
slab_alloc_node mm/slub.c:4037 [inline]<br />
kmem_cache_alloc_node_noprof+0x16b/0x320 mm/slub.c:4080<br />
__alloc_skb+0x1c3/0x440 net/core/skbuff.c:667<br />
alloc_skb include/linux/skbuff.h:1320 [inline]<br />
alloc_skb_with_frags+0xc3/0x770 net/core/skbuff.c:6528<br />
sock_alloc_send_pskb+0x91a/0xa60 net/core/sock.c:2815<br />
sock_alloc_send_skb include/net/sock.h:1778 [inline]<br />
queue_oob+0x108/0x680 net/unix/af_unix.c:2198<br />
unix_stream_sendmsg+0xd24/0xf80 net/unix/af_unix.c:2351<br />
sock_sendmsg_nosec net/socket.c:730 [inline]<br />
__sock_sendmsg+0x221/0x270 net/socket.c:745<br />
____sys_sendmsg+0x525/0x7d0 net/socket.c:2597<br />
___sys_sendmsg net/socket.c:2651 [inline]<br />
__sys_sendmsg+0x2b0/0x3a0 net/socket.c:2680<br />
do_syscall_x64 arch/x86/entry/common.c:52 [inline]<br />
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83<br />
entry_SYSCALL_64_after_hwframe+0x77/0x7f<br />
<br />
Freed by task 5235:<br />
kasan_save_stack mm/kasan/common.c:47<br />
---truncated---
Impact
Base Score 3.x
7.80
Severity 3.x
HIGH
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.9.8 (including) | 6.10 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.10 (including) | 6.11.2 (excluding) |
To consult the complete list of CPE names with products and versions, see this page



