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

CVE-2026-97420: Linux Kernel BPF Buffer Overflow Vulnerability

CVE-2026-97420 is a buffer overflow flaw in the Linux kernel BPF subsystem affecting sysctl value replacement. Attackers can trigger out-of-bounds memory access. This post explains technical details, impact, 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-97420 Overview

CVE-2026-97420 is a Linux kernel vulnerability in the Berkeley Packet Filter (BPF) subsystem. The flaw resides in bpf_sysctl_set_new_value(), which replaces pending sysctl write values on behalf of cgroup/sysctl BPF programs. The helper copied buf_len bytes into the replacement buffer without appending a NUL terminator. Downstream sysctl parsers assume NUL-terminated input and can read past the allocated region. Kernel Address Sanitizer (KASAN) testing confirmed a slab-out-of-bounds read in strnchrnul() when exercising /proc/sys/net/core/flow_limit_cpu_bitmap with a cgroup/sysctl BPF program.

Critical Impact

A local attacker with the ability to load cgroup/sysctl BPF programs can trigger an out-of-bounds read in kernel memory, potentially leaking adjacent kernel data or causing kernel instability.

Affected Products

  • Linux kernel BPF subsystem with cgroup/sysctl program support
  • Kernel builds containing bpf_sysctl_set_new_value() prior to the referenced fix commits
  • Development branch identified as 7.1.0-rc3-00269-g8370ca1f87cc in the reproducer

Discovery Timeline

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

Technical Details for CVE-2026-97420

Vulnerability Analysis

The proc_sys_call_handler() function in the Linux kernel guarantees that buffers passed to sysctl proc handlers are NUL-terminated. BPF programs attached to the cgroup/sysctl hook can override pending sysctl writes using bpf_sysctl_set_new_value(). The helper allocates a replacement buffer and copies caller-supplied data into it, then hands that buffer directly to the proc handler. The pre-fix implementation copied exactly buf_len bytes without placing a \0 byte at offset buf_len, breaking the NUL-termination invariant.

Downstream parsers such as bitmap_parse() and flow_limit_cpu_sysctl() rely on string functions like strnchrnul() to locate value boundaries. When the replacement buffer lacks a terminator and the caller fills it with non-zero bytes, those parsers walk beyond the end of the allocation. KASAN flagged this as a slab-out-of-bounds read occurring zero bytes past the right edge of a 4096-byte region.

Root Cause

The helper rejects buf_len values greater than PAGE_SIZE - 1, so sufficient space always exists to store the terminator. The implementation omitted that write. The fix appends '\0' at offset buf_len after copying the replacement data, restoring the sysctl NUL-termination contract.

Attack Vector

Exploitation requires the ability to load and attach a cgroup/sysctl BPF program, which typically needs CAP_BPF or CAP_SYS_ADMIN within a user namespace. The attacker writes non-zero bytes into the original user buffer targeting a sysctl such as /proc/sys/net/core/flow_limit_cpu_bitmap. The BPF program invokes bpf_sysctl_set_new_value() to substitute a replacement value lacking a terminating NUL. The subsequent proc handler read crosses the allocation boundary.

See the upstream fix commits for implementation details: Kernel Git Commit 3b2814dd, Kernel Git Commit 76c14b10, and Kernel Git Commit a66e3b5b.

Detection Methods for CVE-2026-97420

Indicators of Compromise

  • KASAN kernel log entries referencing slab-out-of-bounds in strnchrnul originating from flow_limit_cpu_sysctl or bitmap_parse call stacks
  • Kernel oops or BUG: traces that include proc_sys_call_handler followed by sysctl parsing functions
  • Unexpected loads of cgroup/sysctl type BPF programs on hosts that do not normally use them

Detection Strategies

  • Audit bpf() syscall activity for BPF_PROG_LOAD operations with program type BPF_PROG_TYPE_CGROUP_SYSCTL
  • Monitor writes to /proc/sys/net/core/flow_limit_cpu_bitmap and other bitmap-style sysctls from unprivileged workloads
  • Correlate kernel ring buffer messages containing KASAN with sysctl write events in process telemetry

Monitoring Recommendations

  • Centralize dmesg and /var/log/kern.log collection to catch KASAN or out-of-bounds reports from fleet hosts running debug kernels
  • Track user namespace creation combined with BPF program loads, which is a common privilege path to this subsystem
  • Baseline the inventory of BPF programs attached to cgroup hooks and alert on new attachments

How to Mitigate CVE-2026-97420

Immediate Actions Required

  • Apply the upstream fix that appends '\0' after the replaced sysctl value in bpf_sysctl_set_new_value()
  • Rebuild and deploy kernels incorporating the referenced stable commits across affected systems
  • Restrict CAP_BPF and user namespace creation for untrusted workloads until patched kernels are rolled out

Patch Information

The fix is available in three upstream commits: 3b2814dd842a, 76c14b10f50e, and a66e3b5bacf3. After applying the fix, the KASAN reproducer targeting /proc/sys/net/core/flow_limit_cpu_bitmap no longer generates out-of-bounds reports.

Workarounds

  • Disable or restrict loading of cgroup/sysctl BPF programs by setting kernel.unprivileged_bpf_disabled=1
  • Disable unprivileged user namespaces using kernel.unprivileged_userns_clone=0 where distribution policy allows
  • Apply seccomp or Linux Security Module (LSM) policies that block the bpf() syscall for workloads that do not require it
bash
# Configuration example
sysctl -w kernel.unprivileged_bpf_disabled=1
sysctl -w kernel.unprivileged_userns_clone=0

# Persist across reboots
echo 'kernel.unprivileged_bpf_disabled=1' >> /etc/sysctl.d/99-bpf-hardening.conf
echo 'kernel.unprivileged_userns_clone=0' >> /etc/sysctl.d/99-bpf-hardening.conf

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.