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

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

CVE-2026-98035 is a use-after-free vulnerability in the Linux kernel's BPF subsystem affecting rhtab element recycling. This flaw could allow unsafe memory operations in NMI context. This article covers technical details, affected versions, impact analysis, and mitigation strategies.

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-98035 Overview

CVE-2026-98035 is a Linux kernel vulnerability in the Berkeley Packet Filter (BPF) subsystem. The flaw affects how rhtab (resizable hash table) map elements handle special fields during recycling. The functions rhtab_map_update_existing() and rhtab_delete_elem() invoke bpf_obj_free_fields() when replacing or deleting a value. These map operations can execute from BPF programs in Non-Maskable Interrupt (NMI) context, where releasing a referenced kernel pointer (kptr) or other complex field is not safe.

Critical Impact

Freeing complex BPF object fields in NMI context can lead to kernel instability, memory corruption, or use-after-free conditions when BPF programs manipulate rhtab maps.

Affected Products

  • Linux kernel versions containing the BPF rhtab map implementation
  • Systems running BPF programs that update or delete rhtab map elements
  • Kernel builds prior to the fix commits 28fde135 and 65cc95ea

Discovery Timeline

  • 2026-09-25 - CVE-2026-98035 published to NVD
  • 2026-09-25 - Last updated in NVD database

Technical Details for CVE-2026-98035

Vulnerability Analysis

The vulnerability affects the BPF rhtab map implementation in the Linux kernel. When a BPF program updates or deletes an rhtab map element, the kernel calls bpf_obj_free_fields() to release any special fields attached to the stored value. These special fields can include timers, workqueues, task work, and referenced kernel pointers (kptrs).

BPF programs can execute in NMI context, where many kernel subsystems cannot be invoked safely. Releasing a referenced kptr or similar complex ownership field from NMI context violates the locking and allocation rules of those subsystems. Array and hash map implementations avoid this problem by cancelling only asynchronous fields that are safe to stop in the caller context, deferring final cleanup to the memory allocator destructor.

The rhtab implementation did not follow this pattern, exposing the kernel to unsafe field cleanup during NMI execution. The fix replaces the direct bpf_obj_free_fields() call with bpf_obj_cancel_fields(), which cancels only timers, workqueues, and task work. The rhtab_mem_dtor() destructor handles kptr release when the allocation is eventually destroyed.

Root Cause

The root cause is improper handling of BPF object ownership state during map element recycling. The rhtab code path assumed caller context was always safe for full field cleanup. This assumption fails when BPF programs invoke update or delete operations from NMI handlers.

Attack Vector

Exploitation requires the ability to load and execute BPF programs that interact with rhtab maps from NMI context. A local user with sufficient privileges to load BPF programs could trigger unsafe field release paths. The practical attack surface depends on local BPF loading permissions and the presence of rhtab maps containing kptrs or other complex fields.

See the upstream fix commits for technical details: Kernel Git Commit 28fde135 and Kernel Git Commit 65cc95ea.

Detection Methods for CVE-2026-98035

Indicators of Compromise

  • Kernel panics or warnings referencing bpf_obj_free_fields in NMI stack traces
  • Unexpected kernel log entries related to rhtab map operations during BPF program execution
  • Memory corruption indicators or use-after-free detections in BPF subsystem code paths

Detection Strategies

  • Audit loaded BPF programs for use of rhtab maps containing kptrs, timers, or workqueue fields
  • Monitor kernel version and build metadata to identify systems lacking the fix commits
  • Correlate BPF syscall activity with kernel error messages originating from NMI contexts

Monitoring Recommendations

  • Enable kernel audit logging for bpf() syscall invocations, particularly BPF_MAP_UPDATE_ELEM and BPF_MAP_DELETE_ELEM
  • Track processes with CAP_BPF or CAP_SYS_ADMIN capabilities that load BPF programs
  • Collect kernel crash dumps and inspect call stacks for rhtab-related functions during unexpected faults

How to Mitigate CVE-2026-98035

Immediate Actions Required

  • Apply the upstream kernel patches referenced in commits 28fde135 and 65cc95ea
  • Update to a Linux kernel release incorporating the fix from your distribution vendor
  • Restrict BPF program loading to trusted administrators by limiting CAP_BPF and CAP_SYS_ADMIN capabilities

Patch Information

The fix is available in the mainline Linux kernel through commits 28fde135 and 65cc95ea. The patch replaces direct bpf_obj_free_fields() calls in rhtab map update and delete paths with bpf_obj_cancel_fields(), deferring kptr release to the memory destructor rhtab_mem_dtor().

Workarounds

  • Disable unprivileged BPF by setting kernel.unprivileged_bpf_disabled=1 via sysctl
  • Avoid loading BPF programs that use rhtab maps containing referenced kptrs until patched
  • Enforce Linux Security Module policies (SELinux, AppArmor) that restrict BPF syscall usage to approved workloads
bash
# Configuration example
# Disable unprivileged BPF program loading
sysctl -w kernel.unprivileged_bpf_disabled=1
echo 'kernel.unprivileged_bpf_disabled=1' >> /etc/sysctl.d/99-bpf-hardening.conf

# Verify kernel version after patching
uname -r

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.