CVE-2024-38574 libbpf: Prevent null-pointer dereference when prog to load has no BTF

Medium 5.5 Published Updated

A null pointer dereference in libbpf causes a segmentation fault when loading BPF programs without BTF information, leading to denial of service.

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-38574?

CVE-2024-38574 is a medium-severity vulnerability in Linux kernel, published on 19 Jun 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:

libbpf: Prevent null-pointer dereference when prog to load has no BTF

In bpf_objec_load_prog(), there's no guarantee that obj->btf is non-NULL when passing it to btf__fd(), and this function does not perform any check before dereferencing its argument (as bpf_object__btf_fd() used to do). As a consequence, we get segmentation fault errors in bpftool (for example) when trying to load programs that come without BTF information.

v2: Keep btf__fd() in the fix instead of reverting to bpf_object__btf_fd().

Weakness: CWE-476

Which versions are affected by CVE-2024-38574?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2024-38574?

Apply the vendor's patch.

Is CVE-2024-38574 being exploited?

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

All Linux kernel vulnerabilities

Sources

Also known as BELL-CVE-2024-38574, DEBIAN-CVE-2024-38574, GHSA-cv67-23pp-jfh2, UBUNTU-CVE-2024-38574.

Is CVE-2024-38574 in your software?

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

Check your SBOMs for free