CVE-2026-31413

HIGH

bpf: Fix unsound scalar forking in maybe_fork_scalars() for BPF_OR

Title source: cna
STIX 2.1

Exploitation Summary

EIP tracks 2 public exploits for CVE-2026-31413. PoCs published by fearlessresponsesolution, Rat5ak.

AI-analyzed exploit summary This repository contains a functional exploit for CVE-2026-31413, a BPF verifier bug allowing container escape via arbitrary kernel memory read/write. The PoC includes multiple exploit tiers, from credential overwrite to kernel code injection, demonstrating full privilege escalation from CAP_BPF+CAP_PERFMON to root.

Description

In the Linux kernel, the following vulnerability has been resolved: bpf: Fix unsound scalar forking in maybe_fork_scalars() for BPF_OR maybe_fork_scalars() is called for both BPF_AND and BPF_OR when the source operand is a constant. When dst has signed range [-1, 0], it forks the verifier state: the pushed path gets dst = 0, the current path gets dst = -1. For BPF_AND this is correct: 0 & K == 0. For BPF_OR this is wrong: 0 | K == K, not 0. The pushed path therefore tracks dst as 0 when the runtime value is K, producing an exploitable verifier/runtime divergence that allows out-of-bounds map access. Fix this by passing env->insn_idx (instead of env->insn_idx + 1) to push_stack(), so the pushed path re-executes the ALU instruction with dst = 0 and naturally computes the correct result for any opcode.

Exploits (2)

github WORKING POC
by fearlessresponsesolution · tsqlpoc
https://github.com/fearlessresponsesolution/cve-pocs/tree/master/pocs/CVE-2026-31413

This repository contains a functional exploit for CVE-2026-31413, a BPF verifier bug allowing container escape via arbitrary kernel memory read/write. The PoC includes multiple exploit tiers, from credential overwrite to kernel code injection, demonstrating full privilege escalation from CAP_BPF+CAP_PERFMON to root.

Classification
Working Poc 95%
Attack Type
Lpe
Complexity
Complex
Reliability
Reliable
Target: Linux kernel 6.12.76-docker
No auth needed
Prerequisites: CAP_BPF capability · CAP_PERFMON capability · access to /proc/kallsyms
devstral-2 · analyzed May 21, 2026 Full analysis →
nomisec WORKING POC
by Rat5ak · poc
https://github.com/Rat5ak/CVE-2026-31413-BPF-Container-Escape

This repository contains a functional exploit for CVE-2026-31413, a BPF verifier soundness bug allowing container escape via arbitrary kernel read/write, leading to host root access. The exploit leverages a one-byte off-by-one error in the BPF verifier's state forking logic.

Classification
Working Poc 100%
Attack Type
Lpe
Complexity
Complex
Reliability
Reliable
Target: Linux Kernel (6.12.75+ through 7.0-rc4)
Auth required
Prerequisites: CAP_BPF · CAP_PERFMON · CAP_NET_ADMIN
devstral-2 · analyzed Apr 12, 2026 Full analysis →

Scores

CVSS v3 7.8
EPSS 0.0001
EPSS Percentile 1.0%
Attack Vector LOCAL
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Details

CWE
CWE-125
Status published
Products (14)
Linux/Linux < 7.0-rc1
Linux/Linux 4c122e8ae14950cf6b59d208fc5160f7c601e746 - 58bd87d0e69204dbd739e4387a1edb0c4b1644e7
Linux/Linux 6.12.75 - 6.12.80
Linux/Linux 6.12.80 - 6.12.*
Linux/Linux 6.18.16 - 6.18.21
Linux/Linux 6.18.21 - 6.18.*
Linux/Linux 6.19.11 - 6.19.*
Linux/Linux 6.19.6 - 6.19.11
Linux/Linux 7.0-rc1
Linux/Linux 7.0-rc5
... and 4 more
Published Apr 12, 2026
Tracked Since Apr 12, 2026