nday
CVE-2024-39510

cachefiles: fix slab-use-after-free in cachefiles_ondemand_daemon_read()

Linux / Linux

Disclosed . nday has no fix record for it yet; that does not mean no patch exists. None of the four PoC sources lists it. Not in CISA KEV.

tags weakness typeuse-after-free accesslocalno user interaction productLinux kernel product typeoperating system
why these tags

nday derives these tags by fixed rules from the facts below; NVD, the CNA and other sources do not assign them. Vocabulary and rules: ~/tags.

use-after-free
CWE-416, stated by NVD's analysts
local
AV:L in CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H (CVSS 3.1) from NVD's analysts
no user interaction
UI:N in CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H (CVSS 3.1) from NVD's analysts
Linux kernel
affected products in the CVE record: Linux · LinuxCPE names NVD's analysts give as vulnerable: o:linux:linux_kernel
operating system
affected products in the CVE record: Linux · LinuxCPE names NVD's analysts give as vulnerable: o:linux:linux_kernelthe product type of Linux kernel in nday's product registry
stage
DIS
disclosed
cvss
no score yet

Lifecycle

x axis UTC; dot = exact minute, wide bar = date only, hollow = unknown or inferred.
time unknown
DISdisclosed
2024-07-12T12:20Z
PATpatch
no record yet
ANAanalysis
no record yet
POCPoC
no record yet
ITWexploited
no record yet
KEVKEV
no record yet

Summary

In the Linux kernel, the following vulnerability has been resolved:

cachefiles: fix slab-use-after-free in cachefiles_ondemand_daemon_read()

We got the following issue in a fuzz test of randomly issuing the restore command:

==================================================================
BUG: KASAN: slab-use-after-free in cachefiles_ondemand_daemon_read+0xb41/0xb60
Read of size 8 at addr ffff888122e84088 by task ondemand-04-dae/963

CPU: 13 PID: 963 Comm: ondemand-04-dae Not tainted 6.8.0-dirty #564
Call Trace:
 kasan_report+0x93/0xc0
 cachefiles_ondemand_daemon_read+0xb41/0xb60
 vfs_read+0x169/0xb50
 ksys_read+0xf5/0x1e0

Allocated by task 116:
 kmem_cache_alloc+0x140/0x3a0
 cachefiles_lookup_cookie+0x140/0xcd0
 fscache_cookie_state_machine+0x43c/0x1230
 [...]

Freed by task 792:
 kmem_cache_free+0xfe/0x390
 cachefiles_put_object+0x241/0x480
 fscache_cookie_state_machine+0x5c8/0x1230
 [...]
==================================================================

Following is the process that triggers the issue:

mount | daemon_thread1 | daemon_thread2 ------------------------------------------------------------ cachefiles_withdraw_cookie

cachefiles_ondemand_clean_object(object)
 cachefiles_ondemand_send_req
  REQ_A = kzalloc(sizeof(*req) + data_len)
  wait_for_completion(&REQ_A->done)

           cachefiles_daemon_read
            cachefiles_ondemand_daemon_read
             REQ_A = cachefiles_ondemand_select_req
             msg->object_id = req->object->ondemand->ondemand_id
                                 ------ restore ------
                                 cachefiles_ondemand_restore
                                 xas_for_each(&xas, req, ULONG_MAX)
                                  xas_set_mark(&xas, CACHEFILES_REQ_NEW)

                                 cachefiles_daemon_read
                                  cachefiles_ondemand_daemon_read
                                   REQ_A = cachefiles_ondemand_select_req
             copy_to_user(_buffer, msg, n)
              xa_erase(&cache->reqs, id)
              complete(&REQ_A->done)
             ------ close(fd) ------
             cachefiles_ondemand_fd_release
              cachefiles_put_object
cachefiles_put_object
 kmem_cache_free(cachefiles_object_jar, object)
                                   REQ_A->object->ondemand->ondemand_id
                                    // object UAF !!!

When we see the request within xa_lock, req->object must not have been freed yet, so grab the reference count of object before xa_unlock to avoid the above issue.

Original text of the CVE record (cvelist), shown as published.

Event log

+DISdisclosed

CVE record published by Linux.

src cvelist · nday , bulk import · raw
{
  "id": 336779,
  "type": "disclosed",
  "source": "cvelist",
  "url": "https://www.cve.org/CVERecord?id=CVE-2024-39510",
  "occurred_at": "2024-07-12T12:20:40.901Z",
  "observed_at": "2026-11-13T05:38:37.339084Z",
  "is_backfill": true,
  "dedupe_key": "",
  "detail": {
    "ssvc": {
      "timestamp": "2024-09-10T17:06:40.868593Z",
      "automatable": "no",
      "exploitation": "none",
      "technical_impact": "partial"
    },
    "state": "PUBLISHED",
    "date_published": "2024-07-12T12:20:40.901Z",
    "assigner_short_name": "Linux"
  }
}

Report an error

report an error or omission

Something on this page wrong or missing? Tell the editors; if they accept it, this page's revision log says so publicly. Upstream data is not changed.

Researcher discussion

0 researchers mentioned this in the last 7 days

Posts on X by researchers on nday's list that mention this CVE, shown as posted. nday does not check them.

nday has not collected any post on X by listed researchers that mentions this CVE.

Discussion

0 comments

No comments yet.