HIGH 7.8

CVE-2026-53033: Linux Kernel Use-After-Free in BPF Sockmap Unix Socket Iterator

A race condition exists in the Linux kernel's BPF sockmap implementation for Unix domain sockets. When a BPF iterator program updates a sockmap while a socket connection is closing, a stale pointer can be dereferenced, leading to a use-after-free memory error. An attacker with local access and unprivileged user privileges can exploit this by crafting a BPF program that interacts with sockmap operations concurrent with socket state transitions, potentially causing a kernel crash or memory corruption.

Source data · NVD / CISA · public domain

CVSS
3.1 · 7.8 HIGH · CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Weaknesses (CWE)
CWE-416, CWE-825
Affected products
1 configuration(s)
Published / Modified
2026-06-24 / 2026-07-15

NVD description (verbatim)

In the Linux kernel, the following vulnerability has been resolved: bpf, sockmap: Take state lock for af_unix iter When a BPF iterator program updates a sockmap, there is a race condition in unix_stream_bpf_update_proto() where the `peer` pointer can become stale[1] during a state transition TCP_ESTABLISHED -> TCP_CLOSE. CPU0 bpf CPU1 close -------- ---------- // unix_stream_bpf_update_proto() sk_pair = unix_peer(sk) if (unlikely(!sk_pair)) return -EINVAL; // unix_release_sock() skpair = unix_peer(sk); unix_peer(sk) = NULL; sock_put(skpair) sock_hold(sk_pair) // UaF More practically, this fix guarantees that the iterator program is consistently provided with a unix socket that remains stable during iterator execution. [1]: BUG: KASAN: slab-use-after-free in unix_stream_bpf_update_proto+0x155/0x490 Write of size 4 at addr ffff8881178c9a00 by task test_progs/2231 Call Trace: dump_stack_lvl+0x5d/0x80 print_report+0x170/0x4f3 kasan_report+0xe4/0x1c0 kasan_check_range+0x125/0x200 unix_stream_bpf_update_proto+0x155/0x490 sock_map_link+0x71c/0xec0 sock_map_update_common+0xbc/0x600 sock_map_update_elem+0x19a/0x1f0 bpf_prog_bbbf56096cdd4f01_selective_dump_unix+0x20c/0x217 bpf_iter_run_prog+0x21e/0xae0 bpf_iter_unix_seq_show+0x1e0/0x2a0 bpf_seq_read+0x42c/0x10d0 vfs_read+0x171/0xb20 ksys_read+0xff/0x200 do_syscall_64+0xf7/0x5e0 entry_SYSCALL_64_after_hwframe+0x76/0x7e Allocated by task 2236: kasan_save_stack+0x30/0x50 kasan_save_track+0x14/0x30 __kasan_slab_alloc+0x63/0x80 kmem_cache_alloc_noprof+0x1d5/0x680 sk_prot_alloc+0x59/0x210 sk_alloc+0x34/0x470 unix_create1+0x86/0x8a0 unix_stream_connect+0x318/0x15b0 __sys_connect+0xfd/0x130 __x64_sys_connect+0x72/0xd0 do_syscall_64+0xf7/0x5e0 entry_SYSCALL_64_after_hwframe+0x76/0x7e Freed by task 2236: kasan_save_stack+0x30/0x50 kasan_save_track+0x14/0x30 kasan_save_free_info+0x3b/0x70 __kasan_slab_free+0x47/0x70 kmem_cache_free+0x11c/0x590 __sk_destruct+0x432/0x6e0 unix_release_sock+0x9b3/0xf60 unix_release+0x8a/0xf0 __sock_release+0xb0/0x270 sock_close+0x18/0x20 __fput+0x36e/0xac0 fput_close_sync+0xe5/0x1a0 __x64_sys_close+0x7d/0xd0 do_syscall_64+0xf7/0x5e0 entry_SYSCALL_64_after_hwframe+0x76/0x7e

9 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

CVE-2026-53033 is a use-after-free vulnerability (CWE-416) in the Linux kernel's unix_stream_bpf_update_proto() function. The vulnerability arises from insufficient synchronization when BPF iterator programs interact with the sockmap infrastructure. Specifically, the `peer` pointer obtained via unix_peer(sk) can become invalid between its initial validation and subsequent dereference due to a concurrent call to unix_release_sock() on another CPU. The race window occurs during TCP state transitions from TCP_ESTABLISHED to TCP_CLOSE. The fix applies proper state locking to ensure atomic access to the peer socket reference, preventing the stale pointer dereference. The KASAN output confirms writes to freed memory allocated in unix_create1() and freed in unix_release_sock().

Business impact

Kernel crashes triggered by this vulnerability can cause unscheduled downtime on affected Linux systems. While exploitation requires local access and unprivileged user context, the impact is severe: an attacker could deny service by repeatedly crashing the kernel or potentially corrupt kernel memory state. For environments running BPF-based networking tools, policy enforcers, or telemetry systems that interact with sockmap, this represents a stability risk. Multi-tenant systems and container platforms where untrusted users can load BPF programs face elevated risk.

Affected systems

The Linux kernel is affected across versions that support BPF sockmap operations on Unix domain sockets. Specifically, the vulnerability resides in the af_unix iterator implementation integrated with BPF. Verify exact affected kernel version ranges against the official Linux kernel security advisories and your vendor's distribution patches. Systems actively using BPF-based sockmap monitoring, policy enforcement, or socket redirection are most directly exposed.

Exploitability

Exploitation requires local system access and the ability to load and execute BPF programs, typically available to unprivileged users on systems with permissive BPF policy. An attacker must craft a BPF iterator program that updates the sockmap while simultaneously triggering Unix socket state transitions—achievable through multi-threaded or multi-process socket operations. The race condition has a narrow but reliable window, as demonstrated by the KASAN reproduction. No authentication bypass or remote code execution primitive is needed, but privilege escalation potential exists if kernel memory corruption can be leveraged further.

Remediation

Apply the Linux kernel patch that adds state locking to unix_stream_bpf_update_proto(). This ensures the peer socket reference is held under the socket state lock, eliminating the race window. Verify the patched kernel version against your distribution's advisory. Interim mitigation: disable unprivileged BPF loading via sysctl (kernel.unprivileged_bpf_disabled=1) or use SELinux/AppArmor policies to restrict BPF capability on non-critical systems. However, this may impact monitoring or policy tools relying on BPF.

Patch guidance

Locate the patch corresponding to CVE-2026-53033 in the Linux kernel upstream repository (kernel.org) or your distribution's patch tracker. The fix adds synchronization via the socket state lock (typically unix_state_lock) around the unix_peer() call and subsequent sock_hold(). Apply the patch to your kernel source and rebuild, or update to a kernel version that includes this fix. Test in a staging environment, particularly if you run BPF-based networking or observability tools. Prioritize systems allowing unprivileged BPF operations.

Detection guidance

Monitor kernel logs for KASAN splats or BUG messages referencing unix_stream_bpf_update_proto() or use-after-free in sockmap operations. Use 'dmesg' and persistent logging systems to detect crash dumps. In forensic analysis, look for abnormal socket state transitions concurrent with BPF iterator execution. Audit BPF program loading via bpftool or /sys/kernel/debug/tracing/events/bpf* if available. Correlate BPF program load times with system crashes or hangs. Check /proc/sys/kernel/unprivileged_bpf_disabled to confirm BPF restrictions are in place post-patch.

Why prioritize this

This vulnerability scores 7.8 (HIGH) due to local exploitability, high impact (crash or memory corruption), and low attack complexity. While it requires local access, unprivileged user context is sufficient, widening the attack surface. Kernel stability is critical for all services running on affected systems. The combination of straightforward exploitation and severe DoS/memory corruption impact justifies immediate patching, especially for multi-tenant or container environments.

Risk score, explained

The CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H score reflects: Attack Vector Local (AV:L)—only local access is needed; Attack Complexity Low (AC:L)—the race is reliably triggerable with basic BPF and socket operations; Privileges Required Low (PR:L)—unprivileged users can load BPF and create sockets; User Interaction None (UI:N)—no user action required; Scope Unchanged (S:U)—impact is confined to the affected system; and Confidentiality/Integrity/Availability all High (C:H/I:H/A:H)—potential for kernel memory disclosure, corruption, and crash. This yields a score in the HIGH severity range.

Frequently asked questions

Can an unprivileged user exploit this vulnerability?

Yes. An unprivileged user with the ability to load BPF programs and create Unix domain sockets can trigger the race condition. On systems where kernel.unprivileged_bpf_disabled is not set to 1, this is straightforward. Many distributions allow unprivileged BPF by default.

What is a use-after-free and why is it dangerous in the kernel?

A use-after-free occurs when code accesses memory after it has been freed and returned to the allocator. In kernel context, this can lead to reading or writing arbitrary kernel memory via the reused allocation, potentially enabling privilege escalation, information disclosure, or denial of service through corruption or crash.

How does BPF sockmap relate to container security and observability?

BPF sockmap is used to intercept, redirect, and monitor socket traffic at the kernel level. Observability and security tools use it for network policy enforcement, service mesh integration, and traffic inspection. A crash in this code path affects not only the BPF program but the entire kernel.

Is there a workaround if I cannot patch immediately?

Disable unprivileged BPF by setting kernel.unprivileged_bpf_disabled=1, which prevents non-root users from loading BPF programs. This mitigates the attack surface but may break non-privileged monitoring tools. Alternatively, use SELinux or AppArmor to restrict BPF capabilities to trusted processes. Neither is a perfect substitute for patching.

This analysis is based on available vulnerability data as of the publication date. Specific affected kernel versions, patch identifiers, and release dates should be verified against the official Linux kernel security advisories and your distribution's patch announcements. No working exploit code is provided or endorsed. Organizations must test patches in staging environments before production deployment. For proprietary or embedded Linux distributions, consult vendor-specific advisories. Use of BPF and unprivileged operations should be evaluated against your security policies. Source: NVD (public-domain), retrieved 2026-07-31. Analysis generated by SEC.co (claude-haiku-4-5).