CVE-2024-26737: bpf: Fix racing between bpf_timer_cancel_and_free and bpf_timer_cancel

Published Apr 3, 2024
·
Updated

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

bpf: Fix racing between bpftimercancelandfree and bpftimercancel

The following race is possible between bpftimercancelandfree and bpftimercancel. It will lead a UAF on the timer->timer.

bpftimercancel(); spinlock(); t = timer->time; spinunlock();

bpftimercancelandfree(); spinlock(); t = timer->timer; timer->timer = NULL; spinunlock(); hrtimercancel(&t->timer); kfree(t);

/ UAF on t / hrtimercancel(&t->timer);

In bpftimercancelandfree, this patch frees the timer->timer after a rcu grace period. This requires a rcuhead addition to the "struct bpfhrtimer". Another kfree(t) happens in bpftimerinit, this does not need a kfreercu because it is still under the spinlock and timer->timer has not been visible by others yet.

In bpftimercancel, rcureadlock() 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, bpftimercancel() is the only place where timer->timer is used outside of the spinlock.

Another solution considered is to mark a t->flag in bpftimercancel and clear it after hrtimercancel() is done. In bpftimercancelandfree, 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.

Other sources

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

bpf: Fix racing between bpftimercancelandfree and bpftimercancel

The Linux kernel CVE team has assigned CVE-2024-26737 to this issue.

Upstream advisory: https://lore.kernel.org/linux-cve-announce/2024040359-CVE-2024-26737-a9c3@gregkh/T

— Red Hat

Affected Software

15 affected componentsFixes available
redhat/kernel<5.15.150
5.15.150
redhat/kernel<6.1.80
6.1.80
redhat/kernel<6.6.19
6.6.19
redhat/kernel<6.7.7
6.7.7
redhat/kernel<6.8
6.8
Linux Linux kernel>=5.15<5.15.150
Linux Linux kernel>=5.16<6.1.80
Linux Linux kernel>=6.2<6.6.19
Linux Linux kernel>=6.7<6.7.7
Linux Linux kernel=6.8-rc1
Linux Linux kernel=6.8-rc2
Linux Linux kernel=6.8-rc3
Linux Linux kernel=6.8-rc4
Linux Linux kernel=6.8-rc5
debian/linux
5.10.223-15.10.234-16.1.129-16.1.133-16.12.21-16.12.22-1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade debian/linux to a version that resolves this vulnerability.

    Fixed in 5.10.223-1Fixed in 5.10.234-1Fixed in 6.1.129-1Fixed in 6.1.133-1Fixed in 6.12.21-1Fixed in 6.12.22-1
  2. Upgrade

    Upgrade redhat/kernel to a version that resolves this vulnerability.

    Fixed in 5.15.150
  3. Upgrade

    Upgrade redhat/kernel to a version that resolves this vulnerability.

    Fixed in 6.1.80
  4. Upgrade

    Upgrade redhat/kernel to a version that resolves this vulnerability.

    Fixed in 6.6.19
  5. Upgrade

    Upgrade redhat/kernel to a version that resolves this vulnerability.

    Fixed in 6.7.7
  6. Upgrade

    Upgrade redhat/kernel to a version that resolves this vulnerability.

    Fixed in 6.8

Event History

Apr 3, 2024
CVE Published
via MITRE·05:00 PM
Data Sourced
via MITRE·05:00 PM
DescriptionSeverity
Data Sourced
via NVD·05:15 PM
RemedyDescriptionSeverityWeaknessAffected Software
Apr 4, 2024
Data Sourced
via Red Hat·01:35 AM
DescriptionSeverityAffected Software
Jun 8, 2024
Data Sourced
via Launchpad·01:05 AM
Description
Apr 12, 2025
Data Sourced
via Ubuntu·02:15 PM
RemedyDescriptionSeverityAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2024-26737?

CVE-2024-26737 is classified as a moderately severe vulnerability due to potential data corruption risks.

2

How do I fix CVE-2024-26737?

To fix CVE-2024-26737, update to the latest kernel versions mentioned in the advisory: 5.15.150, 6.1.80, 6.6.19, 6.7.7, 6.8, or apply the relevant patches from Red Hat or Debian.

3

Which kernel versions are affected by CVE-2024-26737?

CVE-2024-26737 affects multiple kernel versions, notably those prior to 5.15.150, 6.1.80, and 6.6.19.

4

What type of vulnerability is CVE-2024-26737?

CVE-2024-26737 is a use-after-free vulnerability related to BPF timers in the Linux kernel.

5

Who is impacted by CVE-2024-26737?

Users of affected Linux kernel versions, especially those using Red Hat or Debian distributions, are impacted by CVE-2024-26737.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203