{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2024-41045","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","state":"PUBLISHED","assignerShortName":"Linux","dateReserved":"2024-07-12T12:17:45.624Z","datePublished":"2024-07-29T14:32:02.866Z","dateUpdated":"2026-10-03T10:55:09.752Z"},"containers":{"cna":{"providerMetadata":{"orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","shortName":"Linux","dateUpdated":"2026-10-03T10:55:09.752Z"},"descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Defer work in bpf_timer_cancel_and_free\n\nCurrently, the same case as previous patch (two timer callbacks trying\nto cancel each other) can be invoked through bpf_map_update_elem as\nwell, or more precisely, freeing map elements containing timers. Since\nthis relies on hrtimer_cancel as well, it is prone to the same deadlock\nsituation as the previous patch.\n\nIt would be sufficient to use hrtimer_try_to_cancel to fix this problem,\nas the timer cannot be enqueued after async_cancel_and_free. Once\nasync_cancel_and_free has been done, the timer must be reinitialized\nbefore it can be armed again. The callback running in parallel trying to\narm the timer will fail, and freeing bpf_hrtimer without waiting is\nsufficient (given kfree_rcu), and bpf_timer_cb will return\nHRTIMER_NORESTART, preventing the timer from being rearmed again.\n\nHowever, there exists a UAF scenario where the callback arms the timer\nbefore entering this function, such that if cancellation fails (due to\ntimer callback invoking this routine, or the target timer callback\nrunning concurrently). In such a case, if the timer expiration is\nsignificantly far in the future, the RCU grace period expiration\nhappening before it will free the bpf_hrtimer state and along with it\nthe struct hrtimer, that is enqueued.\n\nHence, it is clear cancellation needs to occur after\nasync_cancel_and_free, and yet it cannot be done inline due to deadlock\nissues. We thus modify bpf_timer_cancel_and_free to defer work to the\nglobal workqueue, adding a work_struct alongside rcu_head (both used at\n_different_ points of time, so can share space).\n\nUpdate existing code comments to reflect the new state of affairs."}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - The vulnerability is reached by loading and running an attacker-authored BPF program via the bpf() syscall, which requires local access to the system. BPF is explicitly classified as a local attack vector in kernel scoring guidance.\nAC:L - The UAF is deterministic and fully attacker-scripted: the BPF callback arms its own timer with a far-future expiry and then deletes its own map element, guaranteeing the freed-while-enqueued hrtimer; no race the attacker cannot control is involved, and the deadlock variant is likewise attacker-orchestrated across two CPUs.\nPR:L - The bpf_timer_* helpers are gated by bpf_token_capable(CAP_BPF), which resolves to ns_capable() in a BPF-token user namespace, so an unprivileged user with a delegated bpffs token (common in container environments) can reach it. This matches established scoring for BPF verifier/helper CVEs.\nUI:N - The attacker loads and triggers the BPF timer entirely on their own; no victim action of any kind is needed.\nS:U - The freed object and the corrupted hrtimer state are both kernel-internal; the impact stays within the kernel's own security authority with no crossing into a hypervisor or IOMMU boundary.\nC:H - The freed bpf_hrtimer remains linked in the per-CPU hrtimer rbtree, so the timer subsystem keeps reading from reallocated heap memory, and controlling the freed slot gives an attacker a reliable kernel-memory read primitive enabling arbitrary disclosure.\nI:H - Enqueue/rebalance operations write rb_node and expiry fields into the freed object, and __run_hrtimer() calls a function pointer fetched from that freed memory, yielding both arbitrary write and control-flow hijack primitives after a heap spray.\nA:H - Both defects reliably take down the machine — the UAF corrupts the per-CPU hrtimer queue causing panics, and the mutual hrtimer_cancel() deadlock between two timer callbacks wedges CPUs in softirq context permanently."}]}],"affected":[{"product":"Linux","vendor":"Linux","defaultStatus":"unaffected","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/bpf/helpers.c"],"versions":[{"version":"b00628b1c7d595ae5b544e059c27b1f5828314b4","lessThan":"5eaa11c500ed07f505f86cec07d5593a71927e26","status":"affected","versionType":"git"},{"version":"b00628b1c7d595ae5b544e059c27b1f5828314b4","lessThan":"7aa5a19279c3639ae8b758b63f05d0c616a39fa1","status":"affected","versionType":"git"},{"version":"b00628b1c7d595ae5b544e059c27b1f5828314b4","lessThan":"a6fcd19d7eac1335eb76bc16b6a66b7f574d1d69","status":"affected","versionType":"git"}]},{"product":"Linux","vendor":"Linux","defaultStatus":"affected","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/bpf/helpers.c"],"versions":[{"version":"5.15","status":"affected"},{"version":"0","lessThan":"5.15","status":"unaffected","versionType":"semver"},{"version":"6.6.158","lessThanOrEqual":"6.6.*","status":"unaffected","versionType":"semver"},{"version":"6.9.10","lessThanOrEqual":"6.9.*","status":"unaffected","versionType":"semver"},{"version":"6.10","lessThanOrEqual":"*","status":"unaffected","versionType":"original_commit_for_fix"}]}],"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.15","versionEndExcluding":"6.6.158"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.15","versionEndExcluding":"6.9.10"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.15","versionEndExcluding":"6.10"}]}]}],"references":[{"url":"https://git.kernel.org/stable/c/5eaa11c500ed07f505f86cec07d5593a71927e26"},{"url":"https://git.kernel.org/stable/c/7aa5a19279c3639ae8b758b63f05d0c616a39fa1"},{"url":"https://git.kernel.org/stable/c/a6fcd19d7eac1335eb76bc16b6a66b7f574d1d69"}],"title":"bpf: Defer work in bpf_timer_cancel_and_free","x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"providerMetadata":{"orgId":"af854a3a-2127-422b-91ae-364da2661108","shortName":"CVE","dateUpdated":"2024-08-02T04:46:51.645Z"},"title":"CVE Program Container","references":[{"url":"https://git.kernel.org/stable/c/7aa5a19279c3639ae8b758b63f05d0c616a39fa1","tags":["x_transferred"]},{"url":"https://git.kernel.org/stable/c/a6fcd19d7eac1335eb76bc16b6a66b7f574d1d69","tags":["x_transferred"]}]},{"metrics":[{"other":{"type":"ssvc","content":{"id":"CVE-2024-41045","role":"CISA Coordinator","options":[{"Exploitation":"none"},{"Automatable":"no"},{"Technical Impact":"partial"}],"version":"2.0.3","timestamp":"2024-09-10T16:23:00.726132Z"}}}],"title":"CISA ADP Vulnrichment","providerMetadata":{"orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","shortName":"CISA-ADP","dateUpdated":"2024-09-11T17:34:02.451Z"}}]}}