CVE-2025-22087 bpf: Fix array bounds error with may_goto

High 7.8 Published Updated

A Linux kernel BPF vulnerability allows out-of-bounds memory access via may_goto, 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-2025-22087?

CVE-2025-22087 is a high-severity memory corruption vulnerability in Linux kernel, published on 16 Apr 2025. 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 array bounds error with may_goto

may_goto uses an additional 8 bytes on the stack, which causes the interpreters[] array to go out of bounds when calculating index by stack_size.

1. If a BPF program is rewritten, re-evaluate the stack size. For non-JIT cases, reject loading directly.

2. For non-JIT cases, calculating interpreters[idx] may still cause out-of-bounds array access, and just warn about it.

3. For jit_requested cases, the execution of bpf_func also needs to be warned. So move the definition of function __bpf_prog_ret0_warn out of the macro definition CONFIG_BPF_JIT_ALWAYS_ON.

Weakness: CWE-125

Which versions are affected by CVE-2025-22087?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2025-22087?

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-2025-22087 being exploited?

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

All Linux kernel vulnerabilities

Sources

Also known as BELL-CVE-2025-22087, DEBIAN-CVE-2025-22087, GHSA-89pr-66m5-4vwv, UBUNTU-CVE-2025-22087.

Is CVE-2025-22087 in your software?

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

Check your SBOMs for free