CVE-2024-50253 bpf: Check the validity of nr_words in bpf_iter_bits_new()

High 7.8 Published Updated

An integer overflow in the Linux kernel BPF subsystem allows stack corruption, potentially enabling code execution or privilege escalation.

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

CVE-2024-50253 is a high-severity vulnerability in Linux kernel, published on 9 Nov 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: Check the validity of nr_words in bpf_iter_bits_new()

Check the validity of nr_words in bpf_iter_bits_new(). Without this check, when multiplication overflow occurs for nr_bits (e.g., when nr_words = 0x0400-0001, nr_bits becomes 64), stack corruption may occur due to bpf_probe_read_kernel_common(..., nr_bytes = 0x2000-0008).

Fix it by limiting the maximum value of nr_words to 511. The value is derived from the current implementation of BPF memory allocator. To ensure compatibility if the BPF memory allocator's size limitation changes in the future, use the helper bpf_mem_alloc_check_size() to check whether nr_bytes is too larger. And return -E2BIG instead of -ENOMEM for oversized nr_bytes.

Which versions are affected by CVE-2024-50253?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2024-50253?

Apply the vendor's patch.

Is CVE-2024-50253 being exploited?

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

All Linux kernel vulnerabilities

Sources

Also known as BELL-CVE-2024-50253, DEBIAN-CVE-2024-50253, GHSA-gjpp-3xmc-r9c5, UBUNTU-CVE-2024-50253.

Is CVE-2024-50253 in your software?

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

Check your SBOMs for free