KernelScan.io

HIGH Introduced in 5.13

bpf InnerMap UAF

CVE-2026-98033

CVSS 7.8 / 10.0 KernelScan AI

CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

01

In the Linux kernel, the following vulnerability has been resolved: bpf: Preserve inner map identity in callback frames Callback frame constructors initialize map-typed argument registers with __mark_reg_known_zero() and then restore map_ptr. This clears map_uid, which is the only field distinguishing inner maps that share an inner_map_meta template. When a timer callback invokes bpf_for_each_map_elem() on a second inner map, both the saved first map and the second map value can reach the nested callback as the same template with map_uid zero. bpf_timer_init() then accepts pairing the timer from the second map with the first map. The runtime records the first map in the timer without taking a reference. Freeing that map does not find the timer stored in the second map, so a later timer callback dereferences the freed map. Copy map_uid from the same caller register as map_ptr when constructing for-each, timer/workqueue, and task-work callback arguments. The existing identity check can then reject mismatched inner maps while allowing a callback value to be paired with its actual map.

02

Engine v0.6.0

Risk summary

A BPF verifier flaw causes it to lose the unique identity of inner maps when setting up callback arguments, allowing a crafted program to pair a timer with the wrong map. The runtime stores that map without a reference, so freeing it creates a use-after-free that can be dereferenced by a later timer callback. Any user who can load BPF programs can trigger this, potentially achieving kernel memory corruption.

Affectedkernel/bpf/verifier.c (bpf verifier)

Vulnerability analysis

When the kernel prepares arguments for BPF callbacks that operate on inner maps, it accidentally strips the unique identity that distinguishes different inner maps sharing the same template. Because of this, the system can mistakenly match a timer from one inner map to a different inner map. The runtime stores that first map without keeping a reference, so once the map is freed the timer still points to freed memory, and a later callback dereferences it. The corrected code preserves each inner map's unique identity during callback setup, allowing the runtime to detect and refuse mismatched pairings. Any local user capable of loading BPF programs can trigger this flaw; on typical systems that requires CAP_BPF, while systems allowing unprivileged BPF loading remove even that requirement.

03

BranchIntroducedFixed inPatch commit
7.25.137.2.766ff2eff093d
mainline5.137.3-rc2b90c5d770dad