{
  "threat_severity" : "Moderate",
  "public_date" : "2024-07-29T00:00:00Z",
  "bugzilla" : {
    "description" : "kernel: cachefiles: fix slab-use-after-free in cachefiles_withdraw_cookie()",
    "id" : "2300431",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=2300431"
  },
  "cvss3" : {
    "cvss3_base_score" : "7.0",
    "cvss3_scoring_vector" : "CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H",
    "status" : "verified"
  },
  "cwe" : "CWE-416",
  "details" : [ "In the Linux kernel, the following vulnerability has been resolved:\ncachefiles: fix slab-use-after-free in cachefiles_withdraw_cookie()\nWe got the following issue in our fault injection stress test:\n==================================================================\nBUG: KASAN: slab-use-after-free in cachefiles_withdraw_cookie+0x4d9/0x600\nRead of size 8 at addr ffff888118efc000 by task kworker/u78:0/109\nCPU: 13 PID: 109 Comm: kworker/u78:0 Not tainted 6.8.0-dirty #566\nCall Trace:\n<TASK>\nkasan_report+0x93/0xc0\ncachefiles_withdraw_cookie+0x4d9/0x600\nfscache_cookie_state_machine+0x5c8/0x1230\nfscache_cookie_worker+0x91/0x1c0\nprocess_one_work+0x7fa/0x1800\n[...]\nAllocated by task 117:\nkmalloc_trace+0x1b3/0x3c0\ncachefiles_acquire_volume+0xf3/0x9c0\nfscache_create_volume_work+0x97/0x150\nprocess_one_work+0x7fa/0x1800\n[...]\nFreed by task 120301:\nkfree+0xf1/0x2c0\ncachefiles_withdraw_cache+0x3fa/0x920\ncachefiles_put_unbind_pincount+0x1f6/0x250\ncachefiles_daemon_release+0x13b/0x290\n__fput+0x204/0xa00\ntask_work_run+0x139/0x230\ndo_exit+0x87a/0x29b0\n[...]\n==================================================================\nFollowing is the process that triggers the issue:\np1                |             p2\n------------------------------------------------------------\nfscache_begin_lookup\nfscache_begin_volume_access\nfscache_cache_is_live(fscache_cache)\ncachefiles_daemon_release\ncachefiles_put_unbind_pincount\ncachefiles_daemon_unbind\ncachefiles_withdraw_cache\nfscache_withdraw_cache\nfscache_set_cache_state(cache, FSCACHE_CACHE_IS_WITHDRAWN);\ncachefiles_withdraw_objects(cache)\nfscache_wait_for_objects(fscache)\natomic_read(&fscache_cache->object_count) == 0\nfscache_perform_lookup\ncachefiles_lookup_cookie\ncachefiles_alloc_object\nrefcount_set(&object->ref, 1);\nobject->volume = volume\nfscache_count_object(vcookie->cache);\natomic_inc(&fscache_cache->object_count)\ncachefiles_withdraw_volumes\ncachefiles_withdraw_volume\nfscache_withdraw_volume\n__cachefiles_free_volume\nkfree(cachefiles_volume)\nfscache_cookie_state_machine\ncachefiles_withdraw_cookie\ncache = object->volume->cache;\n// cachefiles_volume UAF !!!\nAfter setting FSCACHE_CACHE_IS_WITHDRAWN, wait for all the cookie lookups\nto complete first, and then wait for fscache_cache->object_count == 0 to\navoid the cookie exiting after the volume has been freed and triggering\nthe above issue. Therefore call fscache_withdraw_volume() before calling\ncachefiles_withdraw_objects().\nThis way, after setting FSCACHE_CACHE_IS_WITHDRAWN, only the following two\ncases will occur:\n1) fscache_begin_lookup fails in fscache_begin_volume_access().\n2) fscache_withdraw_volume() will ensure that fscache_count_object() has\nbeen executed before calling fscache_wait_for_objects().", "A potential use after free was found in the Linux kernel." ],
  "statement" : "Red Hat Product Security has rated the attack complexity as high for the following reasons:\n1. To get this bug to work, precise ordering in concurrent operations on cache volumes/cookies need to be broken, thereby causing a race condition.\n2. Reproducing a use-after-free from a race is not very deterministic\n3. The state is super important as cachefiles_withdraw_cookies() are called only during specific lifecycle events.\n4. It can not be easily triggered by unprivileged users.",
  "affected_release" : [ {
    "product_name" : "Red Hat Enterprise Linux 9",
    "release_date" : "2024-11-12T00:00:00Z",
    "advisory" : "RHSA-2024:9315",
    "cpe" : "cpe:/a:redhat:enterprise_linux:9",
    "package" : "kernel-0:5.14.0-503.11.1.el9_5"
  }, {
    "product_name" : "Red Hat Enterprise Linux 9",
    "release_date" : "2024-11-12T00:00:00Z",
    "advisory" : "RHSA-2024:9315",
    "cpe" : "cpe:/o:redhat:enterprise_linux:9",
    "package" : "kernel-0:5.14.0-503.11.1.el9_5"
  } ],
  "package_state" : [ {
    "product_name" : "Red Hat Enterprise Linux 6",
    "fix_state" : "Out of support scope",
    "package_name" : "kernel",
    "cpe" : "cpe:/o:redhat:enterprise_linux:6"
  }, {
    "product_name" : "Red Hat Enterprise Linux 7",
    "fix_state" : "Out of support scope",
    "package_name" : "kernel",
    "cpe" : "cpe:/o:redhat:enterprise_linux:7"
  }, {
    "product_name" : "Red Hat Enterprise Linux 7",
    "fix_state" : "Out of support scope",
    "package_name" : "kernel-rt",
    "cpe" : "cpe:/o:redhat:enterprise_linux:7"
  }, {
    "product_name" : "Red Hat Enterprise Linux 8",
    "fix_state" : "Not affected",
    "package_name" : "kernel",
    "cpe" : "cpe:/o:redhat:enterprise_linux:8"
  }, {
    "product_name" : "Red Hat Enterprise Linux 8",
    "fix_state" : "Not affected",
    "package_name" : "kernel-rt",
    "cpe" : "cpe:/o:redhat:enterprise_linux:8"
  }, {
    "product_name" : "Red Hat Enterprise Linux 9",
    "fix_state" : "Affected",
    "package_name" : "kernel-rt",
    "cpe" : "cpe:/o:redhat:enterprise_linux:9"
  } ],
  "references" : [ "https://www.cve.org/CVERecord?id=CVE-2024-41057\nhttps://nvd.nist.gov/vuln/detail/CVE-2024-41057\nhttps://lore.kernel.org/linux-cve-announce/2024072902-CVE-2024-41057-1d06@gregkh/T" ],
  "name" : "CVE-2024-41057",
  "csaw" : false
}