CVE-2024-40909 bpf: Fix a potential use-after-free in bpf_link_free()

High 7.8 Published Updated

A use-after-free vulnerability in the Linux kernel's BPF subsystem allows attackers to potentially execute arbitrary code or escalate privileges.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Local or same network only
Victim action needed
Not needed
Fix
Available

What is CVE-2024-40909?

CVE-2024-40909 is a high-severity use after free vulnerability in Linux kernel, published on 12 Jul 2024. It can only be exploited from the same machine or local network, with no action from the victim.

Official description

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

bpf: Fix a potential use-after-free in bpf_link_free()

After commit 1a80dbcb2dba, bpf_link can be freed by link->ops->dealloc_deferred, but the code still tests and uses link->ops->dealloc afterward, which leads to a use-after-free as reported by syzbot. Actually, one of them should be sufficient, so just call one of them instead of both. Also add a WARN_ON() in case of any problematic implementation.

Weakness: CWE-416

Which versions are affected by CVE-2024-40909?

It affects 1 product.

Linux distribution packages (4)
kernel-livepatch-SLE15-SP6-RT_Update_1 SUSE:Linux Enterprise Live Patching 15 SP6All versions2-150600.1.8.1
kernel-livepatch-SLE15-SP6_Update_2 SUSE:Linux Enterprise Live Patching 15 SP6All versions2-150600.13.6.3
kernel-livepatch-SLE15-SP6_Update_3 SUSE:Linux Enterprise Live Patching 15 SP6All versions2-150600.13.6.3
klp-build openSUSE:TumbleweedAll versions0~20240812.ad9f0e0-1.1

Products include Linux kernel.

How do I fix CVE-2024-40909?

Apply the vendor's patch.

Upgrade to the fixed version. These bugs are found with fuzzing and sanitisers and avoided by memory-safe languages. More about Use after free.

Is CVE-2024-40909 being exploited?

There is no known exploitation of CVE-2024-40909 in the wild and no public exploit code.

All Linux kernel vulnerabilities

Sources

Also known as BELL-CVE-2024-40909, DEBIAN-CVE-2024-40909, GHSA-v89r-8c65-6vgh, SUSE-SU-2024:3322-1, SUSE-SU-2024:3387-1, SUSE-SU-2024:3398-1 and 2 more.

Is CVE-2024-40909 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free