CVE-2024-44946 kcm: Serialise kcm_sendmsg() for the same socket.
- 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:
kcm: Serialise kcm_sendmsg() for the same socket.
syzkaller reported UAF in kcm_release(). [0]
The scenario is
-
Thread A builds a skb with MSG_MORE and sets kcm->seq_skb.
-
Thread A resumes building skb from kcm->seq_skb but is blocked
by sk_stream_wait_memory() -
Thread B calls sendmsg() concurrently, finishes building kcm->seq_skb
and puts the skb to the write queue -
Thread A faces an error and finally frees skb that is already in the
write queue -
kcm_release() does double-free the skb in the write queue
When a thread is building a MSG_MORE skb, another thread must not touch it.
Let's add a per-sk mutex and serialise kcm_sendmsg().
[0]:
BUG: KASAN: slab-use-after-free in __skb_unlink include/linux/skbuff.h:2366 [inline]
BUG: KASAN: slab-use-after-free in __skb_dequeue include/linux/skbuff.h:2385 [inline]
BUG: KASAN: slab-use-after-free in __skb_queue_purge_reason include/linux/skbuff.h:3175 [inline]
BUG: KASAN: slab-use-after-free in __skb_queue_purge include/linux/skbuff.h:3181 [inline]
BUG: KASAN: slab-use-after-free in kcm_release+0x170/0x4c8 net/kcm/kcmsock.c:1691
Read of size 8 at addr ffff0000ced0fc80 by task syz-executor329/6167
CPU: 1 PID: 6167 Comm: syz-executor329 Tainted: G B 6.8.0-rc5-syzkaller-g9abbc24128bc #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
Call trace:
dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:291
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:298
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xd0/0x124 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:377 [inline]
print_report+0x178/0x518 mm/kasan/report.c:488
kasan_report+0xd8/0x138 mm/kasan/report.c:601
__asan_report_load8_noabort+0x20/0x2c mm/kasan/report_generic.c:381
__skb_unlink include/linux/skbuff.h:2366 [inline]
__skb_dequeue include/linux/skbuff.h:2385 [inline]
__skb_queue_purge_reason include/linux/skbuff.h:3175 [inline]
__skb_queue_purge include/linux/skbuff.h:3181 [inline]
kcm_release+0x170/0x4c8 net/kcm/kcmsock.c:1691
__sock_release net/socket.c:659 [inline]
sock_close+0xa4/0x1e8 net/socket.c:1421
__fput+0x30c/0x738 fs/file_table.c:376
____fput+0x20/0x30 fs/file_table.c:404
task_work_run+0x230/0x2e0 kernel/task_work.c:180
exit_task_work include/linux/task_work.h:38 [inline]
do_exit+0x618/0x1f64 kernel/exit.c:871
do_group_exit+0x194/0x22c kernel/exit.c:1020
get_signal+0x1500/0x15ec kernel/signal.c:2893
do_signal+0x23c/0x3b44 arch/arm64/kernel/signal.c:1249
do_notify_resume+0x74/0x1f4 arch/arm64/kernel/entry-common.c:148
exit_to_user_mode_prepare arch/arm64/kernel/entry-common.c:169 [inline]
exit_to_user_mode arch/arm64/kernel/entry-common.c:178 [inline]
el0_svc+0xac/0x168 arch/arm64/kernel/entry-common.c:713
el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730
el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598
Allocated by task 6166:
kasan_save_stack mm/kasan/common.c:47 [inline]
kasan_save_track+0x40/0x78 mm/kasan/common.c:68
kasan_save_alloc_info+0x70/0x84 mm/kasan/generic.c:626
unpoison_slab_object mm/kasan/common.c:314 [inline]
__kasan_slab_alloc+0x74/0x8c mm/kasan/common.c:340
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook mm/slub.c:3813 [inline]
slab_alloc_node mm/slub.c:3860 [inline]
kmem_cache_alloc_node+0x204/0x4c0 mm/slub.c:3903
__alloc_skb+0x19c/0x3d8 net/core/skbuff.c:641
alloc_skb include/linux/skbuff.h:1296 [inline]
kcm_sendmsg+0x1d3c/0x2124 net/kcm/kcmsock.c:783
sock_sendmsg_nosec net/socket.c:730 [inline]
__sock_sendmsg net/socket.c:745 [inline]
sock_sendmsg+0x220/0x2c0 net/socket.c:768
splice_to_socket+0x7cc/0xd58 fs/splice.c:889
do_splice_from fs/splice.c:941 [inline]
direct_splice_actor+0xec/0x1d8 fs/splice.c:1164
splice_direct_to_actor+0x438/0xa0c fs/splice.c:1108
do_splice_direct_actor
---truncated---
Upgrade path
11 packages: 11 fixed.
| Package | Affected | Fixed in | Status |
|---|---|---|---|
| debian/linux(Debian 12) | < 6.1.112-1; = 6.1.27-1; = 6.1.37-1; = 6.1.38-1 +26 more | 6.1.112-1 | Fixed |
| debian/linux(Debian 13) | < 6.10.7-1 | 6.10.7-1 | Fixed |
| debian/linux(Debian 14) | < 6.10.7-1 | 6.10.7-1 | Fixed |
| Linux kernel | < 4.19.321; < 5.4.283; < 5.10.225; < 5.15.166 +20 more | 4.19.321, 5.4.283, 5.10.225, 5.15.166, 6.1.107, 6.6.48, 6.10.7, 6.11, 8c9cdbf600143bd6835c8b8351e5ac956da79aec, 9c8d544ed619f704e2b70e63e08ab75630c2ea23, 72da240aafb142630cf16adc803ccdacb3780849, 6633b17840bf828921254d788ccd15602843fe9b, 00425508f30baa5ab6449a1f478480ca7cffa6da, 807067bf014d4a3ae2cc55bd3de16f22a01eb580, eb06c8d3022ce6738711191c89f9b3e9cfb91914, fa6c23fe6dcac8c8bd63920ee8681292a2bd544e | Fixed |
| Microsoft azure linux | < 6.6.51.1-1 | 6.6.51.1-1 | Fixed |
| Microsoft cbl mariner | < 5.15.167.1-2 | 5.15.167.1-2 | Fixed |
| ubuntu/linux(Ubuntu 22.04) | < 5.15.0-125.135 | 5.15.0-125.135 | Fixed |
| ubuntu/linux(Ubuntu 24.04) | < 6.8.0-50.51 | 6.8.0-50.51 | Fixed |
| ubuntu/linux-kvm(Ubuntu 22.04) | < 5.15.0-1069.74 | 5.15.0-1069.74 | Fixed |
| ubuntu/linux-raspi(Ubuntu 22.04) | < 5.15.0-1065.68 | 5.15.0-1065.68 | Fixed |
| ubuntu/linux-raspi(Ubuntu 24.04) | < 6.8.0-1016.18 | 6.8.0-1016.18 | Fixed |
Affected products
| Product | Affected versions | Fixed in |
|---|---|---|
| Microsoft azure linux | < 6.6.51.1-1 | 6.6.51.1-1 |
| Microsoft cbl mariner | < 5.15.167.1-2 | 5.15.167.1-2 |
| debian/linux(Debian:12) | < 6.1.112-1 | 6.1.112-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.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 38 more
| Product | Affected versions | Fixed 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.10.7-1 | 6.10.7-1 |
| debian/linux(Debian:14) | < 6.10.7-1 | 6.10.7-1 |
| ubuntu/linux(Ubuntu:22.04) | < 5.15.0-125.135 | 5.15.0-125.135 |
| ubuntu/linux-kvm(Ubuntu:22.04) | < 5.15.0-1069.74 | 5.15.0-1069.74 |
| ubuntu/linux-raspi(Ubuntu:22.04) | < 5.15.0-1065.68 | 5.15.0-1065.68 |
| Linux kernel | >= ab7ac4eb9832e32a09f4e8042705484d2fb0aad3, < 8c9cdbf600143bd6835c8b8351e5ac956da79aec | 8c9cdbf600143bd6835c8b8351e5ac956da79aec |
| Linux kernel | >= ab7ac4eb9832e32a09f4e8042705484d2fb0aad3, < 6633b17840bf828921254d788ccd15602843fe9b | 6633b17840bf828921254d788ccd15602843fe9b |
| Linux kernel | >= ab7ac4eb9832e32a09f4e8042705484d2fb0aad3, < eb06c8d3022ce6738711191c89f9b3e9cfb91914 | eb06c8d3022ce6738711191c89f9b3e9cfb91914 |
| Linux kernel | >= ab7ac4eb9832e32a09f4e8042705484d2fb0aad3, < fa6c23fe6dcac8c8bd63920ee8681292a2bd544e | fa6c23fe6dcac8c8bd63920ee8681292a2bd544e |
| Linux kernel | >= ab7ac4eb9832e32a09f4e8042705484d2fb0aad3, < 72da240aafb142630cf16adc803ccdacb3780849 | 72da240aafb142630cf16adc803ccdacb3780849 |
| Linux kernel | >= ab7ac4eb9832e32a09f4e8042705484d2fb0aad3, < 00425508f30baa5ab6449a1f478480ca7cffa6da | 00425508f30baa5ab6449a1f478480ca7cffa6da |
| Linux kernel | >= ab7ac4eb9832e32a09f4e8042705484d2fb0aad3, < 9c8d544ed619f704e2b70e63e08ab75630c2ea23 | 9c8d544ed619f704e2b70e63e08ab75630c2ea23 |
| Linux kernel | >= ab7ac4eb9832e32a09f4e8042705484d2fb0aad3, < 807067bf014d4a3ae2cc55bd3de16f22a01eb580 | 807067bf014d4a3ae2cc55bd3de16f22a01eb580 |
| Linux kernel | = 4.6 | No fix listed |
| Linux kernel | < 4.19.321 | 4.19.321 |
| Linux kernel | < 5.4.283 | 5.4.283 |
| Linux kernel | < 5.10.225 | 5.10.225 |
| Linux kernel | < 5.15.166 | 5.15.166 |
| Linux kernel | < 6.1.107 | 6.1.107 |
| Linux kernel | < 6.6.48 | 6.6.48 |
| Linux kernel | < 6.10.7 | 6.10.7 |
| Linux kernel | < 6.11 | 6.11 |
| ubuntu/linux(Ubuntu:24.04) | < 6.8.0-50.51 | 6.8.0-50.51 |
| ubuntu/linux-raspi(Ubuntu:24.04) | < 6.8.0-1016.18 | 6.8.0-1016.18 |
| Linux kernel | >= 4.6, < 6.1.107 | 6.1.107 |
| Linux kernel | >= 6.2, < 6.6.48 | 6.6.48 |
| Linux kernel | >= 6.7, < 6.10.7 | 6.10.7 |
| Linux kernel | = 6.11-rc1 | No fix listed |
| Linux kernel | = 6.11-rc2 | No fix listed |
| Linux kernel | = 6.11-rc3 | No fix listed |
| Linux kernel | = 6.11-rc4 | No fix listed |
References
- MSRC Security Update Guide vendor-advisory
- kernel vendor-advisory
- Debian Security Tracker CVE-2024-44946 vendor-advisory
- Ubuntu CVE tracker vendor-advisory
- USN-7088-1 vendor-advisory
- USN-7088-2 vendor-advisory
- USN-7088-3 vendor-advisory
- USN-7088-4 vendor-advisory
- USN-7100-1 vendor-advisory
- USN-7100-2 vendor-advisory
- USN-7088-5 vendor-advisory
- USN-7119-1 vendor-advisory
- USN-7123-1 vendor-advisory
- USN-7144-1 vendor-advisory
- USN-7154-1 vendor-advisory
- USN-7155-1 vendor-advisory
- USN-7156-1 vendor-advisory
- USN-7154-2 vendor-advisory
- USN-7194-1 vendor-advisory
- USN-7196-1 vendor-advisory
- www.cve.org
- git.kernel.org
- git.kernel.org
- git.kernel.org
- git.kernel.org
- git.kernel.org patch
- git.kernel.org patch
- git.kernel.org patch
- git.kernel.org patch
- lists.debian.org
- lists.debian.org
- ENISA EUVD EUVD-2024-41246 third-party-advisory