CVE-2024-27398
Severity CVSS v4.0:
Pending analysis
Type:
Unavailable / Other
Publication date:
14/05/2024
Last modified:
30/11/2024
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
Bluetooth: Fix use-after-free bugs caused by sco_sock_timeout<br />
<br />
When the sco connection is established and then, the sco socket<br />
is releasing, timeout_work will be scheduled to judge whether<br />
the sco disconnection is timeout. The sock will be deallocated<br />
later, but it is dereferenced again in sco_sock_timeout. As a<br />
result, the use-after-free bugs will happen. The root cause is<br />
shown below:<br />
<br />
Cleanup Thread | Worker Thread<br />
sco_sock_release |<br />
sco_sock_close |<br />
__sco_sock_close |<br />
sco_sock_set_timer |<br />
schedule_delayed_work |<br />
sco_sock_kill | (wait a time)<br />
sock_put(sk) //FREE | sco_sock_timeout<br />
| sock_hold(sk) //USE<br />
<br />
The KASAN report triggered by POC is shown below:<br />
<br />
[ 95.890016] ==================================================================<br />
[ 95.890496] BUG: KASAN: slab-use-after-free in sco_sock_timeout+0x5e/0x1c0<br />
[ 95.890755] Write of size 4 at addr ffff88800c388080 by task kworker/0:0/7<br />
...<br />
[ 95.890755] Workqueue: events sco_sock_timeout<br />
[ 95.890755] Call Trace:<br />
[ 95.890755] <br />
[ 95.890755] dump_stack_lvl+0x45/0x110<br />
[ 95.890755] print_address_description+0x78/0x390<br />
[ 95.890755] print_report+0x11b/0x250<br />
[ 95.890755] ? __virt_addr_valid+0xbe/0xf0<br />
[ 95.890755] ? sco_sock_timeout+0x5e/0x1c0<br />
[ 95.890755] kasan_report+0x139/0x170<br />
[ 95.890755] ? update_load_avg+0xe5/0x9f0<br />
[ 95.890755] ? sco_sock_timeout+0x5e/0x1c0<br />
[ 95.890755] kasan_check_range+0x2c3/0x2e0<br />
[ 95.890755] sco_sock_timeout+0x5e/0x1c0<br />
[ 95.890755] process_one_work+0x561/0xc50<br />
[ 95.890755] worker_thread+0xab2/0x13c0<br />
[ 95.890755] ? pr_cont_work+0x490/0x490<br />
[ 95.890755] kthread+0x279/0x300<br />
[ 95.890755] ? pr_cont_work+0x490/0x490<br />
[ 95.890755] ? kthread_blkcg+0xa0/0xa0<br />
[ 95.890755] ret_from_fork+0x34/0x60<br />
[ 95.890755] ? kthread_blkcg+0xa0/0xa0<br />
[ 95.890755] ret_from_fork_asm+0x11/0x20<br />
[ 95.890755] <br />
[ 95.890755]<br />
[ 95.890755] Allocated by task 506:<br />
[ 95.890755] kasan_save_track+0x3f/0x70<br />
[ 95.890755] __kasan_kmalloc+0x86/0x90<br />
[ 95.890755] __kmalloc+0x17f/0x360<br />
[ 95.890755] sk_prot_alloc+0xe1/0x1a0<br />
[ 95.890755] sk_alloc+0x31/0x4e0<br />
[ 95.890755] bt_sock_alloc+0x2b/0x2a0<br />
[ 95.890755] sco_sock_create+0xad/0x320<br />
[ 95.890755] bt_sock_create+0x145/0x320<br />
[ 95.890755] __sock_create+0x2e1/0x650<br />
[ 95.890755] __sys_socket+0xd0/0x280<br />
[ 95.890755] __x64_sys_socket+0x75/0x80<br />
[ 95.890755] do_syscall_64+0xc4/0x1b0<br />
[ 95.890755] entry_SYSCALL_64_after_hwframe+0x67/0x6f<br />
[ 95.890755]<br />
[ 95.890755] Freed by task 506:<br />
[ 95.890755] kasan_save_track+0x3f/0x70<br />
[ 95.890755] kasan_save_free_info+0x40/0x50<br />
[ 95.890755] poison_slab_object+0x118/0x180<br />
[ 95.890755] __kasan_slab_free+0x12/0x30<br />
[ 95.890755] kfree+0xb2/0x240<br />
[ 95.890755] __sk_destruct+0x317/0x410<br />
[ 95.890755] sco_sock_release+0x232/0x280<br />
[ 95.890755] sock_close+0xb2/0x210<br />
[ 95.890755] __fput+0x37f/0x770<br />
[ 95.890755] task_work_run+0x1ae/0x210<br />
[ 95.890755] get_signal+0xe17/0xf70<br />
[ 95.890755] arch_do_signal_or_restart+0x3f/0x520<br />
[ 95.890755] syscall_exit_to_user_mode+0x55/0x120<br />
[ 95.890755] do_syscall_64+0xd1/0x1b0<br />
[ 95.890755] entry_SYSCALL_64_after_hwframe+0x67/0x6f<br />
[ 95.890755]<br />
[ 95.890755] The buggy address belongs to the object at ffff88800c388000<br />
[ 95.890755] which belongs to the cache kmalloc-1k of size 1024<br />
[ 95.890755] The buggy address is located 128 bytes inside of<br />
[ 95.890755] freed 1024-byte region [ffff88800c388000, ffff88800c388400)<br />
[ 95.890755]<br />
[ 95.890755] The buggy address belongs to the physical page:<br />
[ 95.890755] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88800c38a800 pfn:0xc388<br />
[ 95.890755] head: order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0<br />
[ 95.890755] ano<br />
---truncated---
Impact
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/012363cb1bec5f33a7b94629ab2c1086f30280f2
- https://git.kernel.org/stable/c/1b33d55fb7355e27f8c82cd4ecd560f162469249
- https://git.kernel.org/stable/c/3212afd00e3cda790fd0583cb3eaef8f9575a014
- https://git.kernel.org/stable/c/33a6e92161a78c1073d90e27abe28d746feb0a53
- https://git.kernel.org/stable/c/483bc08181827fc475643272ffb69c533007e546
- https://git.kernel.org/stable/c/50c2037fc28df870ef29d9728c770c8955d32178
- https://git.kernel.org/stable/c/6a18eeb1b3bbc67c20d9609c31dca6a69b4bcde5
- https://git.kernel.org/stable/c/bfab2c1f7940a232cd519e82fff137e308abfd93
- http://www.openwall.com/lists/oss-security/2024/11/29/1
- http://www.openwall.com/lists/oss-security/2024/11/30/1
- http://www.openwall.com/lists/oss-security/2024/11/30/2
- https://git.kernel.org/stable/c/012363cb1bec5f33a7b94629ab2c1086f30280f2
- https://git.kernel.org/stable/c/1b33d55fb7355e27f8c82cd4ecd560f162469249
- https://git.kernel.org/stable/c/3212afd00e3cda790fd0583cb3eaef8f9575a014
- https://git.kernel.org/stable/c/33a6e92161a78c1073d90e27abe28d746feb0a53
- https://git.kernel.org/stable/c/483bc08181827fc475643272ffb69c533007e546
- https://git.kernel.org/stable/c/50c2037fc28df870ef29d9728c770c8955d32178
- https://git.kernel.org/stable/c/6a18eeb1b3bbc67c20d9609c31dca6a69b4bcde5
- https://git.kernel.org/stable/c/bfab2c1f7940a232cd519e82fff137e308abfd93
- https://lists.debian.org/debian-lts-announce/2024/06/msg00019.html
- https://lists.debian.org/debian-lts-announce/2024/06/msg00020.html
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/DW2MIOIMOFUSNLHLRYX23AFR36BMKD65/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/OTB4HWU2PTVW5NEYHHLOCXDKG3PYA534/
- https://security.netapp.com/advisory/ntap-20240912-0012/



