Vulnerability · Published Jul 29, 2024 · Assigned by Linux
CVE-2024-41057cachefiles: fix slab-use-after-free in cachefiles_withdraw_cookie()
High 7.8
In plain English
A high-severity security flaw in Linux from Linux. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.3% (higher than 20% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.
Official description
In the Linux kernel, the following vulnerability has been resolved: cachefiles: fix slab-use-after-free in cachefiles_withdraw_cookie() We got the following issue in our fault injection stress test: ================================================================== BUG: KASAN: slab-use-after-free in cachefiles_withdraw_cookie+0x4d9/0x600 Read of size 8 at addr ffff888118efc000 by task kworker/u78:0/109 CPU: 13 PID: 109 Comm: kworker/u78:0 Not tainted 6.8.0-dirty #566 Call Trace: <TASK> kasan_report+0x93/0xc0 cachefiles_withdraw_cookie+0x4d9/0x600 fscache_cookie_state_machine+0x5c8/0x1230 fscache_cookie_worker+0x91/0x1c0 process_one_work+0x7fa/0x1800 [...] Allocated by task 117: kmalloc_trace+0x1b3/0x3c0 cachefiles_acquire_volume+0xf3/0x9c0 fscache_create_volume_work+0x97/0x150 process_one_work+0x7fa/0x1800 [...] Freed by task 120301: kfree+0xf1/0x2c0 cachefiles_withdraw_cache+0x3fa/0x920 cachefiles_put_unbind_pincount+0x1f6/0x250 cachefiles_daemon_release+0x13b/0x290 __fput+0x204/0xa00 task_work_run+0x139/0x230 do_exit+0x87a/0x29b0 [...] ================================================================== Following is the process that triggers the issue: p1 | p2 ------------------------------------------------------------ fscache_begin_lookup fscache_begin_volume_access fscache_cache_is_live(fscache_cache) cachefiles_daemon_release cachefiles_put_unbind_pincount cachefiles_daemon_unbind cachefiles_withdraw_cache fscache_withdraw_cache fscache_set_cache_state(cache, FSCACHE_CACHE_IS_WITHDRAWN); cachefiles_withdraw_objects(cache) fscache_wait_for_objects(fscache) atomic_read(&fscache_cache->object_count) == 0 fscache_perform_lookup cachefiles_lookup_cookie cachefiles_alloc_object refcount_set(&object->ref, 1); object->volume = volume fscache_count_object(vcookie->cache); atomic_inc(&fscache_cache->object_count) cachefiles_withdraw_volumes cachefiles_withdraw_volume fscache_withdraw_volume __cachefiles_free_volume kfree(cachefiles_volume) fscache_cookie_state_machine cachefiles_withdraw_cookie cache = object->volume->cache; // cachefiles_volume UAF !!! After setting FSCACHE_CACHE_IS_WITHDRAWN, wait for all the cookie lookups to complete first, and then wait for fscache_cache->object_count == 0 to avoid the cookie exiting after the volume has been freed and triggering the above issue. Therefore call fscache_withdraw_volume() before calling cachefiles_withdraw_objects(). This way, after setting FSCACHE_CACHE_IS_WITHDRAWN, only the following two cases will occur: 1) fscache_begin_lookup fails in fscache_begin_volume_access(). 2) fscache_withdraw_volume() will ensure that fscache_count_object() has been executed before calling fscache_wait_for_objects().
Affected packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian:12 | linux | 6.1.106-1 | DEBIAN-CVE-2024-41057 |
| Debian:13 | linux | 6.9.11-1 | DEBIAN-CVE-2024-41057 |
| Debian:14 | linux | 6.9.11-1 | DEBIAN-CVE-2024-41057 |
| Ubuntu:24.04:LTS | linux | 6.8.0-48.48 | USN-7089-1 |
| Ubuntu:24.04:LTS | linux | 6.8.0-48.48 | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-allwinner-5.19 | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:24.04:LTS | linux-aws | 6.8.0-1018.20 | UBUNTU-CVE-2024-41057 |
| Ubuntu:24.04:LTS | linux-aws | 6.8.0-1018.20 | USN-7089-3 |
| Ubuntu:22.04:LTS | linux-aws-5.19 | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-aws-6.2 | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-aws-6.5 | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-aws-6.8 | 6.8.0-1018.19~22.04.1 | USN-7089-3 |
| Ubuntu:22.04:LTS | linux-aws-6.8 | 6.8.0-1018.19~22.04.1 | UBUNTU-CVE-2024-41057 |
| Ubuntu:24.04:LTS | linux-azure | 6.8.0-1017.20 | USN-7089-2 |
| Ubuntu:24.04:LTS | linux-azure | 6.8.0-1017.20 | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-azure-5.19 | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-azure-6.2 | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-azure-6.5 | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-azure-6.8 | 6.8.0-1017.20~22.04.1 | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-azure-6.8 | 6.8.0-1017.20~22.04.1 | USN-7090-1 |
| Ubuntu:22.04:LTS | linux-azure-fde-5.19 | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-azure-fde-6.2 | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:24.04:LTS | linux-gcp | 6.8.0-1017.19 | USN-7089-2 |
| Ubuntu:24.04:LTS | linux-gcp | 6.8.0-1017.19 | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-gcp-5.19 | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-gcp-6.2 | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-gcp-6.5 | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-gcp-6.8 | 6.8.0-1017.19~22.04.1 | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-gcp-6.8 | 6.8.0-1017.19~22.04.1 | USN-7089-1 |
| Ubuntu:24.04:LTS | linux-gke | 6.8.0-1013.17 | USN-7089-6 |
| Ubuntu:24.04:LTS | linux-gke | 6.8.0-1013.17 | UBUNTU-CVE-2024-41057 |
| Ubuntu:24.04:LTS | linux-gkeop | 6.8.0-1002.4 | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-hwe-5.19 | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-hwe-6.2 | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-hwe-6.5 | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-hwe-6.8 | 6.8.0-48.48~22.04.1 | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-hwe-6.8 | 6.8.0-48.48~22.04.1 | USN-7089-1 |
| Ubuntu:24.04:LTS | linux-ibm | 6.8.0-1015.15 | USN-7089-2 |
| Ubuntu:24.04:LTS | linux-ibm | 6.8.0-1015.15 | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-intel-iot-realtime | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:24.04:LTS | linux-lowlatency | 6.8.0-48.48.3 | USN-7089-7 |
| Ubuntu:24.04:LTS | linux-lowlatency | 6.8.0-48.48.3 | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-5.19 | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-6.2 | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-6.5 | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-6.8 | 6.8.0-48.48.3~22.04.1 | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-6.8 | 6.8.0-48.48.3~22.04.1 | USN-7089-7 |
| Ubuntu:24.04:LTS | linux-nvidia | 6.8.0-1017.19 | USN-7095-1 |
| Ubuntu:24.04:LTS | linux-nvidia | 6.8.0-1017.19 | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-nvidia-6.2 | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-nvidia-6.5 | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-nvidia-6.8 | 6.8.0-1017.19~22.04.1 | USN-7095-1 |
| Ubuntu:22.04:LTS | linux-nvidia-6.8 | 6.8.0-1017.19~22.04.1 | UBUNTU-CVE-2024-41057 |
| Ubuntu:24.04:LTS | linux-nvidia-lowlatency | 6.8.0-1017.19.1 | USN-7095-1 |
| Ubuntu:24.04:LTS | linux-nvidia-lowlatency | 6.8.0-1017.19.1 | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-oem-5.17 | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-oem-6.0 | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-oem-6.1 | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-oem-6.5 | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:24.04:LTS | linux-oem-6.8 | 6.8.0-1016.16 | USN-7089-4 |
| Ubuntu:24.04:LTS | linux-oem-6.8 | 6.8.0-1016.16 | UBUNTU-CVE-2024-41057 |
| Ubuntu:24.04:LTS | linux-oracle | 6.8.0-1015.16 | USN-7089-3 |
| Ubuntu:24.04:LTS | linux-oracle | 6.8.0-1015.16 | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-oracle-6.5 | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-oracle-6.8 | 6.8.0-1015.15~22.04.1 | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-oracle-6.8 | 6.8.0-1015.15~22.04.1 | USN-7089-3 |
| Ubuntu:24.04:LTS | linux-raspi | 6.8.0-1014.16 | UBUNTU-CVE-2024-41057 |
| Ubuntu:24.04:LTS | linux-raspi | 6.8.0-1014.16 | USN-7089-5 |
| Ubuntu:22.04:LTS | linux-realtime | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-riscv | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:24.04:LTS | linux-riscv | 6.8.0-48.48.1 | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-riscv-5.19 | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-riscv-6.5 | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-riscv-6.8 | 6.8.0-48.48.1~22.04.2 | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-starfive-5.19 | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-starfive-6.2 | no fix listed | UBUNTU-CVE-2024-41057 |
| Ubuntu:22.04:LTS | linux-starfive-6.5 | no fix listed | UBUNTU-CVE-2024-41057 |
Affected products (as reported)
| Vendor | Product | Versions |
|---|---|---|
| Linux | Linux | fe2140e2f57fef8562e0f9b7cd447d2b08dc2f35 – before 8de253177112a47c9af157d23ae934779188b4e1fe2140e2f57fef8562e0f9b7cd447d2b08dc2f35 – before 9e67589a4a7b7e5660b524d1d5fe61242bcbcc11fe2140e2f57fef8562e0f9b7cd447d2b08dc2f35 – before ef81340401e8a371d6b17f69e76d861920972cfefe2140e2f57fef8562e0f9b7cd447d2b08dc2f35 – before 5d8f805789072ea7fd39504694b7bd17e5f751c4 |
| Linux | Linux | 5.17 |
References
- https://git.kernel.org/stable/c/8de253177112a47c9af157d23ae934779188b4e1
- https://git.kernel.org/stable/c/9e67589a4a7b7e5660b524d1d5fe61242bcbcc11
- https://git.kernel.org/stable/c/ef81340401e8a371d6b17f69e76d861920972cfe
- https://git.kernel.org/stable/c/5d8f805789072ea7fd39504694b7bd17e5f751c4
- https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html