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-98813 Overview
CVE-2026-98813 is a use-after-free vulnerability in the Linux kernel's Berkeley Packet Filter (BPF) subsystem. The flaw affects the bpf_ma_set_dtor() function, which duplicates a map's record so the bpf_mem_alloc destructor can release special fields of hash and rhash map elements. The duplicated record retains borrowed references into the map's BPF Type Format (BTF) without acquiring its own reference. When RCU callbacks defer the final allocator drain to a workqueue, the map and its BTF can be freed before the deferred worker runs, causing the worker to dereference freed memory in btf_is_kernel() and btf_find_struct_meta().
Critical Impact
A local user capable of creating and freeing non-preallocated or resizable BPF hash maps can trigger a kernel use-after-free, leading to memory corruption or denial of service.
Affected Products
- Linux kernel versions containing the bpf_ma_set_dtor() destructor logic prior to the fix
- Non-preallocated BPF hash maps (BPF_MAP_TYPE_HASH without BPF_F_NO_PREALLOC disabled)
- Resizable BPF hash maps that register the memory allocator destructor
Discovery Timeline
- 2026-10-18 - CVE-2026-98813 published to NVD
- 2026-10-19 - Last updated in NVD database
Technical Details for CVE-2026-98813
Vulnerability Analysis
The vulnerability resides in the BPF memory allocator teardown path. bpf_ma_set_dtor() calls btf_record_dup() to duplicate map->record, so the destructor can release kptrs, list heads, and rb roots when the allocator finally frees elements. btf_record_dup() only takes references on kernel and module BTF. Fields whose types live in the map's own BTF keep borrowed pointers into map->btf without any reference count protecting them.
This borrowed state outlives the map under specific conditions. When elements remain in the allocator above its high watermark during teardown, the bulk free queues an RCU callback. bpf_mem_alloc_destroy() then copies the allocator state and defers the final drain, along with the destructor context, to a workqueue. Meanwhile, bpf_map_free() frees map->record and drops the map's BTF reference as soon as map_free() returns.
Root Cause
The root cause is missing reference counting on the map BTF held by the duplicated destructor record. Once the loading program is also gone, the BTF is freed while the deferred worker still accesses it through btf_is_kernel() in btf_record_free() and btf_find_struct_meta() in bpf_obj_free_fields(). KASAN confirms this as a slab-use-after-free at btf_is_kernel+0x19/0x30 within the free_mem_alloc_deferred workqueue path.
Attack Vector
A local unprivileged or privileged user with BPF access creates a non-preallocated or resizable hash map containing special fields. The attacker populates the map above the allocator's high watermark, then triggers teardown by freeing the map while the loading program exits. The deferred free_mem_alloc_deferred worker then dereferences the already-freed BTF, producing memory corruption that can be shaped for further exploitation or kernel panic.
No public proof-of-concept is linked in the enriched data. Technical specifics of the fix are available in the upstream kernel commits ab39974 and b506f56.
Detection Methods for CVE-2026-98813
Indicators of Compromise
- KASAN reports containing slab-use-after-free in btf_is_kernel originating from the events_unbound workqueue running free_mem_alloc_deferred.
- Kernel oops or panic traces that include btf_record_free, htab_dtor_ctx_free, and free_mem_alloc_no_barrier in the call stack.
- Unexpected process termination of workloads using eBPF hash maps with kptr, list, or rb_root value fields.
Detection Strategies
- Enable KASAN on test and staging kernels to surface the use-after-free during BPF-heavy workloads.
- Audit loaded BPF programs with bpftool prog show and bpftool map show to identify non-preallocated hash maps that carry BTF-defined special fields.
- Correlate kernel ring buffer messages with BPF syscall telemetry to flag map-free operations followed by delayed worker faults.
Monitoring Recommendations
- Collect dmesg and /var/log/kern.log output to centralized logging for alerting on BTF-related call stacks.
- Monitor BPF syscall usage (bpf(2)) by non-root processes using auditd rules targeted at BPF_MAP_CREATE and BPF_PROG_LOAD.
- Track kernel version inventory across the Linux fleet to ensure patched builds are deployed before enabling broad BPF access.
How to Mitigate CVE-2026-98813
Immediate Actions Required
- Apply the upstream kernel patches ab39974 and b506f56 once backported to your distribution kernel.
- Restrict unprivileged BPF usage by setting kernel.unprivileged_bpf_disabled=1 where operationally feasible.
- Prioritize patching of multi-tenant hosts, container platforms, and systems that expose BPF to untrusted workloads.
Patch Information
The fix keeps one reference on the map BTF inside the destructor context. Because every non-kernel pointer in the duplicated record is either map->btf or memory owned by it, a single additional reference covers kptrs, list heads, and rb roots. The reference is released only after the duplicated record has been freed, mirroring the behavior that bpf_map_meta_alloc() already applies to inner map records. Apply distribution-provided kernel updates that incorporate commits ab39974 and b506f56.
Workarounds
- Disable unprivileged BPF access system-wide using the kernel.unprivileged_bpf_disabled sysctl.
- Avoid deploying BPF programs that use non-preallocated or resizable hash maps carrying kptr, list_head, or rb_root value fields until patches are applied.
- Use Linux Security Modules such as SELinux or AppArmor policies to constrain which processes may call bpf(2).
# Disable unprivileged BPF at runtime and persist across reboots
sudo sysctl -w kernel.unprivileged_bpf_disabled=1
echo 'kernel.unprivileged_bpf_disabled=1' | sudo tee /etc/sysctl.d/90-bpf-hardening.conf
# Verify the setting
sysctl kernel.unprivileged_bpf_disabled
# Inspect loaded BPF maps for exposure assessment
sudo bpftool map show
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

