CVE-2024-45020 bpf: Fix a kernel verifier crash in stacksafe()

High 7.8 Published Updated

A local attacker can trigger a kernel crash via invalid memory access in the BPF verifier, causing a 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-45020?

CVE-2024-45020 is a high-severity memory corruption vulnerability in Linux kernel, published on 11 Sep 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 kernel verifier crash in stacksafe()

Daniel Hodges reported a kernel verifier crash when playing with sched-ext. Further investigation shows that the crash is due to invalid memory access in stacksafe(). More specifically, it is the following code:

if (exact != NOT_EXACT && old->stack[spi].slot_type[i % BPF_REG_SIZE] != cur->stack[spi].slot_type[i % BPF_REG_SIZE]) return false;

The 'i' iterates old->allocated_stack. If cur->allocated_stack < old->allocated_stack the out-of-bound access will happen.

To fix the issue add 'i >= cur->allocated_stack' check such that if the condition is true, stacksafe() should fail. Otherwise, cur->stack[spi].slot_type[i % BPF_REG_SIZE] memory access is legal.

Weakness: CWE-787

Which versions are affected by CVE-2024-45020?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2024-45020?

Apply the vendor's patch.

Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.

Is CVE-2024-45020 being exploited?

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

All Linux kernel vulnerabilities

Sources

Also known as AZL-49221, BELL-CVE-2024-45020, DEBIAN-CVE-2024-45020, GHSA-jf76-2c3p-rhc5, UBUNTU-CVE-2024-45020.

Is CVE-2024-45020 in your software?

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

Check your SBOMs for free