CVE-2024-39510
Severity CVSS v4.0:
Pending analysis
Type:
CWE-416
Use After Free
Publication date:
12/07/2024
Last modified:
03/11/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
cachefiles: fix slab-use-after-free in cachefiles_ondemand_daemon_read()<br />
<br />
We got the following issue in a fuzz test of randomly issuing the restore<br />
command:<br />
<br />
==================================================================<br />
BUG: KASAN: slab-use-after-free in cachefiles_ondemand_daemon_read+0xb41/0xb60<br />
Read of size 8 at addr ffff888122e84088 by task ondemand-04-dae/963<br />
<br />
CPU: 13 PID: 963 Comm: ondemand-04-dae Not tainted 6.8.0-dirty #564<br />
Call Trace:<br />
kasan_report+0x93/0xc0<br />
cachefiles_ondemand_daemon_read+0xb41/0xb60<br />
vfs_read+0x169/0xb50<br />
ksys_read+0xf5/0x1e0<br />
<br />
Allocated by task 116:<br />
kmem_cache_alloc+0x140/0x3a0<br />
cachefiles_lookup_cookie+0x140/0xcd0<br />
fscache_cookie_state_machine+0x43c/0x1230<br />
[...]<br />
<br />
Freed by task 792:<br />
kmem_cache_free+0xfe/0x390<br />
cachefiles_put_object+0x241/0x480<br />
fscache_cookie_state_machine+0x5c8/0x1230<br />
[...]<br />
==================================================================<br />
<br />
Following is the process that triggers the issue:<br />
<br />
mount | daemon_thread1 | daemon_thread2<br />
------------------------------------------------------------<br />
cachefiles_withdraw_cookie<br />
cachefiles_ondemand_clean_object(object)<br />
cachefiles_ondemand_send_req<br />
REQ_A = kzalloc(sizeof(*req) + data_len)<br />
wait_for_completion(&REQ_A->done)<br />
<br />
cachefiles_daemon_read<br />
cachefiles_ondemand_daemon_read<br />
REQ_A = cachefiles_ondemand_select_req<br />
msg->object_id = req->object->ondemand->ondemand_id<br />
------ restore ------<br />
cachefiles_ondemand_restore<br />
xas_for_each(&xas, req, ULONG_MAX)<br />
xas_set_mark(&xas, CACHEFILES_REQ_NEW)<br />
<br />
cachefiles_daemon_read<br />
cachefiles_ondemand_daemon_read<br />
REQ_A = cachefiles_ondemand_select_req<br />
copy_to_user(_buffer, msg, n)<br />
xa_erase(&cache->reqs, id)<br />
complete(&REQ_A->done)<br />
------ close(fd) ------<br />
cachefiles_ondemand_fd_release<br />
cachefiles_put_object<br />
cachefiles_put_object<br />
kmem_cache_free(cachefiles_object_jar, object)<br />
REQ_A->object->ondemand->ondemand_id<br />
// object UAF !!!<br />
<br />
When we see the request within xa_lock, req->object must not have been<br />
freed yet, so grab the reference count of object before xa_unlock to<br />
avoid the above issue.
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.8 (including) | 6.9.6 (excluding) |
| cpe:2.3:o:linux:linux_kernel:6.10:rc1:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.10:rc2:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.10:rc3:*:*:*:*:*:* |
To consult the complete list of CPE names with products and versions, see this page
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/3958679c49152391209b32be3357193300a51abd
- https://git.kernel.org/stable/c/93064676a2820420a2d37d7c8289f277fe20793d
- https://git.kernel.org/stable/c/cb55625f8eb9d2de8be4da0c4580d48cbb32058e
- https://git.kernel.org/stable/c/da4a827416066191aafeeccee50a8836a826ba10
- https://git.kernel.org/stable/c/3958679c49152391209b32be3357193300a51abd
- https://git.kernel.org/stable/c/93064676a2820420a2d37d7c8289f277fe20793d
- https://git.kernel.org/stable/c/cb55625f8eb9d2de8be4da0c4580d48cbb32058e
- https://git.kernel.org/stable/c/da4a827416066191aafeeccee50a8836a826ba10
- https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html



