CyberSecBulletin
CVE-2024-41045NVD status: Modified

Linux: Use After Free

CVE-2024-41045 is a high-severity use after free vulnerability in Linux, with a CVSS 3.1 base score of 7.8 out of 10. It can be exploited with local access to the system by an attacker with a low-privileged account, without any action from a user. The record lists versions 7b27f15cab4c7d4f28c25b94a5284ad6d9d3695d, 5eaa11c500ed07f505f86cec07d5593a71927e26, 7aa5a19279c3639ae8b758b63f05d0c616a39fa1 as the first without the flaw, so updating Linux to one of those releases or later removes the exposure. There is no confirmed exploitation so far. EPSS estimates a 0.29% chance of exploitation within 30 days, which is low compared with other CVEs.

Next patch cycle

High severity with no evidence of exploitation so far.

What to do

  1. Update Linux to 7b27f15cab4c7d4f28c25b94a5284ad6d9d3695d or 5eaa11c500ed07f505f86cec07d5593a71927e26 or 7aa5a19279c3639ae8b758b63f05d0c616a39fa1 or a6fcd19d7eac1335eb76bc16b6a66b7f574d1d69, whichever matches your release line, or a later version.
  2. Update Linux Kernel to 6.9.10 or a later version.

Affected products and versions

VendorProductAffected versionsFixed in
LinuxLinuxb00628b1c7d595ae5b544e059c27b1f5828314b4 up to, but not including, 7b27f15cab4c7d4f28c25b94a5284ad6d9d3695d; b00628b1c7d595ae5b544e059c27b1f5828314b4 up to, but not including, 5eaa11c500ed07f505f86cec07d5593a71927e26; b00628b1c7d595ae5b544e059c27b1f5828314b4 up to, but not including, 7aa5a19279c3639ae8b758b63f05d0c616a39fa1; b00628b1c7d595ae5b544e059c27b1f5828314b4 up to, but not including, a6fcd19d7eac1335eb76bc16b6a66b7f574d1d69; 5.157b27f15cab4c7d4f28c25b94a5284ad6d9d3695d, 5eaa11c500ed07f505f86cec07d5593a71927e26, 7aa5a19279c3639ae8b758b63f05d0c616a39fa1, a6fcd19d7eac1335eb76bc16b6a66b7f574d1d69
LinuxLinux Kernel5.15 up to, but not including, 6.9.10; 6.106.9.10

Version data comes from the organisation that assigned the CVE. Confirm against the vendor advisory before deciding you are unaffected.

How the severity score breaks down

Attack vector
LocalThe attacker needs local access or must trick a user into running something.
Attack complexity
LowNo special conditions are needed; the attack works reliably.
Privileges required
LowA basic user account is enough.
User interaction
NoneNo action by a victim is required.
Scope
UnchangedImpact stays within the vulnerable component.
Confidentiality
HighAll data handled by the component can be read.
Integrity
HighData or code can be modified at will.
Availability
HighThe component can be taken down completely.

Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H. Scored by NVD.

Scoring systemScoreSeverityScored by
CVSS 3.17.8HighCNA
CVSS 3.17.8HighNVD

Official description

In the Linux kernel, the following vulnerability has been resolved: bpf: Defer work in bpf_timer_cancel_and_free Currently, the same case as previous patch (two timer callbacks trying to cancel each other) can be invoked through bpf_map_update_elem as well, or more precisely, freeing map elements containing timers. Since this relies on hrtimer_cancel as well, it is prone to the same deadlock situation as the previous patch. It would be sufficient to use hrtimer_try_to_cancel to fix this problem, as the timer cannot be enqueued after async_cancel_and_free. Once async_cancel_and_free has been done, the timer must be reinitialized before it can be armed again. The callback running in parallel trying to arm the timer will fail, and freeing bpf_hrtimer without waiting is sufficient (given kfree_rcu), and bpf_timer_cb will return HRTIMER_NORESTART, preventing the timer from being rearmed again. However, there exists a UAF scenario where the callback arms the timer before entering this function, such that if cancellation fails (due to timer callback invoking this routine, or the target timer callback running concurrently). In such a case, if the timer expiration is significantly far in the future, the RCU grace period expiration happening before it will free the bpf_hrtimer state and along with it the struct hrtimer, that is enqueued. Hence, it is clear cancellation needs to occur after async_cancel_and_free, and yet it cannot be done inline due to deadlock issues. We thus modify bpf_timer_cancel_and_free to defer work to the global workqueue, adding a work_struct alongside rcu_head (both used at _different_ points of time, so can share space). Update existing code comments to reflect the new state of affairs.

Source: the CVE record as published by its numbering authority, via NVD and CVE.org.

The underlying weakness: Use After Free

The product reuses or references memory after it has been freed. At some point afterward, the memory may be allocated again and saved in another pointer, while the original pointer references a location somewhere within the new allocation. Any operations using the original pointer are no longer valid because the memory belongs to the code that operates on the new pointer.

How developers prevent this class of flaw

  • Choose a language that provides automatic memory management.
  • When freeing pointers, be sure to set them to NULL once they are freed. However, the utilization of multiple or complex data structures may lower the usefulness of this strategy.

More Use After Free vulnerabilities (CWE-416)

Timeline

  1. CVE record published.
  2. CISA published its SSVC assessment (exploitation: none, automatable: no, technical impact: partial).
  3. Record last changed materially (score, affected products, status or references).

References

Recent Use After Free vulnerabilities

Spotted an error? Tell us.