Skip to main content
Vulnerability Database/CVE-2026-98040

CVE-2026-98040: Linux Kernel Use-After-Free Vulnerability

CVE-2026-98040 is a use-after-free flaw in the Linux kernel BPF verifier that allows improper NULL pointer handling through register precision marking. This article covers technical details, affected versions, and mitigation.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-98040 Overview

CVE-2026-98040 is a Linux kernel vulnerability in the Berkeley Packet Filter (BPF) verifier. The flaw resides in check_cond_jmp_op(), which processes conditional jump operations used as NULL checks on pointers returned by helpers such as bpf_map_lookup_elem(). When a nullable pointer is compared against a scalar register holding zero, the verifier lifts the PTR_MAYBE_NULL marking on the non-NULL branch but fails to mark the zero register as precise. State pruning can then eliminate paths where that register holds a non-zero value, allowing a crafted BPF program to dereference a NULL pointer at runtime.

Critical Impact

A loaded BPF program can bypass the verifier's NULL-check tracking and dereference a NULL pointer in kernel context, resulting in a kernel crash or potential memory safety issues.

Affected Products

  • Linux kernel versions containing the BPF verifier logic prior to commit 6aed0134d3cd
  • Linux kernel stable branches prior to commit ddca9a3b8833
  • Systems that permit unprivileged or privileged BPF program loading

Discovery Timeline

  • 2026-09-25 - CVE-2026-98040 published to the National Vulnerability Database (NVD)
  • 2026-09-25 - Last updated in NVD database

Technical Details for CVE-2026-98040

Vulnerability Analysis

The BPF verifier performs symbolic execution to prove that a program is memory-safe before accepting it. For pointers returned by helpers that can fail, the verifier tags the result with PTR_MAYBE_NULL. A conditional jump of the form if rA == rB is treated as a NULL check when rB is a scalar known to equal zero. On the branch where the pointer differs from zero, the verifier removes PTR_MAYBE_NULL, allowing dereferences.

The defect lies in precision tracking. The verifier does not mark rB as precise during this check. Precision marking tells the verifier that a register's exact value matters for safety and must not be generalized when matching states for pruning.

As shown in the kernel commit message, an attacker can first exercise a path where rB holds zero, which the verifier accepts. A second path assigns rB = 1 and compares it with a pointer that is NULL at runtime. Because rB was never marked precise, the verifier prunes this second path at the earlier checkpoint. At runtime the comparison NULL != 1 is true, the verifier-approved "non-NULL" branch is taken, and the program dereferences a NULL pointer.

Root Cause

The root cause is a missing precision mark on the scalar register used in a register-form NULL check within check_cond_jmp_op(). The verifier's state pruning logic uses precision information to decide which register values must match exactly across checkpoints. Omitting the mark on rB causes states with different rB values to be considered equivalent, erasing a safety-relevant distinction.

Attack Vector

Exploitation requires the ability to load a BPF program into the kernel. On most modern distributions, loading BPF programs requires CAP_BPF or CAP_SYS_ADMIN, but environments permitting unprivileged BPF or containers with these capabilities expand the attack surface. A specially constructed BPF program that triggers the pruning condition causes the kernel to accept code containing a NULL pointer dereference. Executing that program typically produces a kernel oops. Refer to the upstream fixes at the Kernel Git Commit Log (6aed0134d3cd) and the Kernel Git Commit Log (ddca9a3b8833) for the precise changes.

Detection Methods for CVE-2026-98040

Indicators of Compromise

  • Kernel oops or panic messages referencing a NULL pointer dereference inside a BPF program execution context
  • Unexpected bpf() syscall activity from unprivileged users or containerized workloads
  • Loaded BPF programs that compare pointer registers against scalar registers holding known-zero values in unusual patterns

Detection Strategies

  • Audit the kernel version against the fixed commits 6aed0134d3cd and ddca9a3b8833 and flag hosts running vulnerable builds
  • Enable BPF audit logging (CONFIG_BPF_SYSCALL with syscall auditing) to record program loads and the UID that initiated them
  • Correlate kernel crash telemetry with recent bpf() syscalls from the same process to identify likely exploitation attempts

Monitoring Recommendations

  • Monitor /sys/kernel/debug/tracing and dmesg for repeated NULL dereference oopses that follow BPF program loads
  • Alert on BPF program loads from container workloads that should not require eBPF capabilities
  • Track changes to kernel.unprivileged_bpf_disabled sysctl values across the fleet

How to Mitigate CVE-2026-98040

Immediate Actions Required

  • Apply the upstream kernel patches referenced in commits 6aed0134d3cd and ddca9a3b8833 or install the vendor kernel update that incorporates them
  • Set kernel.unprivileged_bpf_disabled=1 to prevent unprivileged users from loading BPF programs where feasible
  • Review container and pod specifications to remove CAP_BPF and CAP_SYS_ADMIN from workloads that do not require them

Patch Information

The fix adjusts check_cond_jmp_op() to mark the zero-valued scalar register as precise when it participates in a register-form NULL check. This forces the verifier's state pruning to distinguish between states where the register is zero and states where it is not, closing the bypass. Patches are available via the Kernel Git Commit Log (6aed0134d3cd) and the Kernel Git Commit Log (ddca9a3b8833). Consult your distribution's security tracker for backported stable releases.

Workarounds

  • Disable unprivileged BPF program loading by setting sysctl kernel.unprivileged_bpf_disabled=1 and persisting it in /etc/sysctl.d/
  • Restrict container capabilities so that CAP_BPF and CAP_SYS_ADMIN are not granted to untrusted workloads
  • Use Linux Security Modules such as SELinux or AppArmor policies to constrain which processes may invoke the bpf() syscall
bash
# Configuration example
# Disable unprivileged BPF program loading persistently
echo 'kernel.unprivileged_bpf_disabled=1' | sudo tee /etc/sysctl.d/99-disable-unpriv-bpf.conf
sudo sysctl --system

# Verify the setting is active
sysctl kernel.unprivileged_bpf_disabled

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.