VDB

CVE-2024-26737

CVE-2024-26737 PUBLISHED CVSS 7.8 HIGH

bpf: Fix racing between bpf_timer_cancel_and_free and bpf_timer_cancel

Reported by linux · Published April 3, 2024

In the Linux kernel, the following vulnerability has been resolved: bpf: Fix racing between bpf_timer_cancel_and_free and bpf_timer_cancel The following race is possible between bpf_timer_cancel_and_free and bpf_timer_cancel. It will lead a UAF on the timer->timer. bpf_timer_cancel(); spin_lock(); t = timer->time; spin_unlock(); bpf_timer_cancel_and_free(); spin_lock(); t = timer->timer; timer->timer = NULL; spin_unlock(); hrtimer_cancel(&t->timer); kfree(t); /* UAF on t */ hrtimer_cancel(&t->timer); In bpf_timer_cancel_and_free, this patch frees the timer->timer after a rcu grace period. This requires a rcu_head addition to the "struct bpf_hrtimer". Another kfree(t) happens in bpf_timer_init, this does not need a kfree_rcu because it is still under the spin_lock and timer->timer has not been visible by others yet. In bpf_timer_cancel, rcu_read_lock() is added because this helper can be used in a non rcu critical section context (e.g. from a sleepable bpf prog). Other timer->timer usages in helpers.c have been audited, bpf_timer_cancel() is the only place where timer->timer is used outside of the spin_lock. Another solution considered is to mark a t->flag in bpf_timer_cancel and clear it after hrtimer_cancel() is done. In bpf_timer_cancel_and_free, it busy waits for the flag to be cleared before kfree(t). This patch goes with a straight forward solution and frees timer->timer after a rcu grace period.

Fixed versions

Upgrade to a fixed version or later. Language registries are listed first, then Linux distributions, then vendor products.

PackageEcosystemFixed in
kernel-develAmazon Linux6.1.82-99.168.amzn2023
kernel-livepatch-6.1.82-99.168Amazon Linux1.0-0.amzn2023

Risk scores

CVSS 3.1
7.8
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Affected products

VendorProductVersions
LinuxLinuxb00628b1c7d595ae5b544e059c27b1f5828314b4, b00628b1c7d595ae5b544e059c27b1f5828314b4, b00628b1c7d595ae5b544e059c27b1f5828314b4
LinuxLinux5.15, 0, 5.15.150
amazon:2023kernel-devel0
amazon:2023kernel-livepatch-6.1.82-99.1680
LinuxLinux*, *, 6.6.19
amazon:2023python3-perf0
amazon:2023kernel-libbpf0
amazon:2023kernel-tools0
amazon:2023kernel-headers0
linuxlinux_kernel5.15, 5.15, 5.15
amazon:2023kernel-modules-extra-common0
amazon:2023kernel0
amazon:2023kernel-tools-devel0
amazon:2023kernel-modules-extra0
amazon:2023perf0
amazon:2023kernel-libbpf-static0
amazon:2023kernel-libbpf-devel0
amazon:2023bpftool0

Timeline

  • Apr 3, 2024 CVE Published
  • Apr 4, 2024 EPSS Score (30 in total, the first dated here)
  • Oct 4, 2024 Coalition ESS Score (16 in total, the first dated here)
  • Jan 15, 2026 Security Advisory (312 in total, the first dated here)
  • Mar 30, 2026 Distribution Patch (272 in total, the first dated here)
  • Oct 25, 2026 CVE Updated

Query this with the API

The same record, from the CLI:

vulnetix vdb vuln CVE-2024-26737
vulnetix vdb fixes CVE-2024-26737

Or with curl, using the org id and key from your account page:

curl -s -H "Authorization: ApiKey ${VULNETIX_ORG_ID}:${VULNETIX_API_KEY}" \
  "https://api.vdb.vulnetix.com/v2/vuln/CVE-2024-26737/fixes/registry"

The Community plan is free and allows 50 queries a day. Get a free API key · API quickstart

References

Look up in the Resolve Platform →
$ Lookup Community · 50/day Open Lookup ›