CVE-2026-53034: Linux Kernel af_unix Sockmap Null-Pointer Dereference DoS
A race condition in the Linux kernel's socket map (sockmap) implementation can cause a kernel crash when BPF programs attempt to update socket maps while Unix domain stream sockets are being connected. The vulnerability occurs because the kernel marks a socket as established before fully initializing its peer connection, creating a narrow window where a BPF sockmap update operation may dereference a null pointer. An attacker with local access and permission to load BPF programs could trigger this null-pointer dereference, causing a denial of service. The issue is resolved by adding a null-check in the Unix stream socket protocol update handler to ensure the peer socket is properly initialized before attempting to access it.
Source data · NVD / CISA · public domain
- CVSS
- 3.1 · 5.5 MEDIUM · CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
- Weaknesses (CWE)
- CWE-476
- 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: Fix af_unix null-ptr-deref in proto update unix_stream_connect() sets sk_state (`WRITE_ONCE(sk->sk_state, TCP_ESTABLISHED)`) _before_ it assigns a peer (`unix_peer(sk) = newsk`). sk_state == TCP_ESTABLISHED makes sock_map_sk_state_allowed() believe that socket is properly set up, which would include having a defined peer. IOW, there's a window when unix_stream_bpf_update_proto() can be called on socket which still has unix_peer(sk) == NULL. CPU0 bpf CPU1 connect -------- ------------ WRITE_ONCE(sk->sk_state, TCP_ESTABLISHED) sock_map_sk_state_allowed(sk) ... sk_pair = unix_peer(sk) sock_hold(sk_pair) sock_hold(newsk) smp_mb__after_atomic() unix_peer(sk) = newsk BUG: kernel NULL pointer dereference, address: 0000000000000080 RIP: 0010:unix_stream_bpf_update_proto+0xa0/0x1b0 Call Trace: sock_map_link+0x564/0x8b0 sock_map_update_common+0x6e/0x340 sock_map_update_elem_sys+0x17d/0x240 __sys_bpf+0x26db/0x3250 __x64_sys_bpf+0x21/0x30 do_syscall_64+0x6b/0x3a0 entry_SYSCALL_64_after_hwframe+0x76/0x7e Initial idea was to move peer assignment _before_ the sk_state update[1], but that involved an additional memory barrier, and changing the hot path was rejected. Then a NULL check during proto update in unix_stream_bpf_update_proto() was considered[2], but the follow-up discussion[3] focused on the root cause, i.e. sockmap update taking a wrong lock. Or, more specifically, missing unix_state_lock()[4]. In the end it was concluded that teaching sockmap about the af_unix locking would be unnecessarily complex[5]. Complexity aside, since BPF_PROG_TYPE_SCHED_CLS and BPF_PROG_TYPE_SCHED_ACT are allowed to update sockmaps, sock_map_update_elem() taking the unix lock, as it is currently implemented in unix_state_lock(): spin_lock(&unix_sk(s)->lock), would be problematic. unix_state_lock() taken in a process context, followed by a softirq-context TC BPF program attempting to take the same spinlock -- deadlock[6]. This way we circled back to the peer check idea[2]. [1]: https://lore.kernel.org/netdev/[email protected]/ [2]: https://lore.kernel.org/netdev/[email protected]/ [3]: https://lore.kernel.org/netdev/[email protected]/ [4]: https://lore.kernel.org/netdev/CAAVpQUA+8GL_j63CaKb8hbxoL21izD58yr1NvhOhU=j+35+3og@mail.gmail.com/ [5]: https://lore.kernel.org/bpf/CAAVpQUAHijOMext28Gi10dSLuMzGYh+jK61Ujn+fZ-wvcODR2A@mail.gmail.com/ [6]: https://lore.kernel.org/bpf/[email protected]/ Summary of scenarios where af_unix/stream connect() may race a sockmap update: 1. connect() vs. bpf(BPF_MAP_UPDATE_ELEM), i.e. sock_map_update_elem_sys() Implemented NULL check is sufficient. Once assigned, socket peer won't be released until socket fd is released. And that's not an issue because sock_map_update_elem_sys() bumps fd refcnf. 2. connect() vs BPF program doing update Update restricted per verifier.c:may_update_sockmap() to BPF_PROG_TYPE_TRACING/BPF_TRACE_ITER BPF_PROG_TYPE_SOCK_OPS (bpf_sock_map_update() only) BPF_PROG_TYPE_SOCKET_FILTER BPF_PROG_TYPE_SCHED_CLS BPF_PROG_TYPE_SCHED_ACT BPF_PROG_TYPE_XDP BPF_PROG_TYPE_SK_REUSEPORT BPF_PROG_TYPE_FLOW_DISSECTOR BPF_PROG_TYPE_SK_LOOKUP Plus one more race to consider: CPU0 bpf CPU1 connect -------- ------------ WRITE_ONCE(sk->sk_state, TCP_ESTABLISHED) sock_map_sk_state_allowed(sk) sock_hold(newsk) smp_mb__after_atomic() ---truncated---
6 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
CVE-2026-53034 is a null-pointer dereference vulnerability in the Linux kernel's af_unix and BPF sockmap subsystems. The root cause is a race condition in unix_stream_connect(), which uses WRITE_ONCE() to set sk_state to TCP_ESTABLISHED before assigning the peer socket via unix_peer(sk) = newsk. This creates a time-of-check-time-of-use (TOCTOU) window where sock_map_sk_state_allowed() evaluates the socket state as established, causing unix_stream_bpf_update_proto() to proceed with peer access. Meanwhile, CPU1 executing connect() has not yet assigned the peer, resulting in a null-pointer dereference at offset 0x80 in the RIP. The fix implements a null-check within unix_stream_bpf_update_proto() to validate the peer socket before dereferencing it, avoiding the need for additional locking that would risk deadlock in softirq context BPF programs. The vulnerability affects sockmap updates initiated both via direct bpf() syscalls (BPF_MAP_UPDATE_ELEM) and from within allowed BPF program types (SCHED_CLS, SCHED_ACT, and others).
Business impact
This vulnerability enables local denial-of-service attacks against systems running vulnerable Linux kernels, particularly those that permit unprivileged BPF program loading or use container orchestration with BPF-based network policies. The crash impacts system availability, potentially disrupting services that depend on kernel stability. For organizations using eBPF for observability, load-balancing, or security enforcement, this bug creates operational risk. The attack requires local access and BPF loading privileges, limiting exposure in heavily restricted environments but posing concern for multi-tenant systems, Kubernetes clusters, and development environments where BPF programs are dynamically loaded. Rapid patching is advisable to prevent triggering the crash through malformed workload deployment.
Affected systems
The Linux kernel is affected. The vulnerability requires a system configuration that permits BPF program loading (specifically programs of type BPF_PROG_TYPE_SCHED_CLS, BPF_PROG_TYPE_SCHED_ACT, or the other specified types that can invoke sockmap updates), combined with the ability to establish Unix domain stream socket connections. Systems with BPF LSM enabled, containerized workloads using BPF-based CNI plugins, or development systems with BPF tooling are most at risk. To confirm if your system is vulnerable, verify the kernel version against available patches and check whether unprivileged BPF is enabled (kernel.unprivileged_bpf_disabled sysctl setting).
Exploitability
Exploitability requires local access and the CAP_BPF and CAP_PERFMON capabilities (or equivalent privileges to load BPF programs). The attack is straightforward: load a BPF program of an allowed type that calls bpf_sock_map_update() or similar sockmap functions, then trigger Unix domain stream socket connections concurrently. The narrow race window is not difficult to hit under normal workload conditions. No user interaction is required. The CVSS score of 5.5 (MEDIUM) reflects the local requirement and privilege constraint, though operational impact is high due to kernel panic. Systems permitting unprivileged BPF loading are at significantly higher risk.
Remediation
Apply a kernel patch that includes the null-check for peer sockets in unix_stream_bpf_update_proto(). This fix validates that unix_peer(sk) is not NULL before attempting to access its fields, preventing the dereference. The patch does not introduce additional locking, avoiding deadlock risks with softirq-context BPF programs. Verify that the patch is included in your kernel source tree and rebuild or obtain a kernel image from your vendor.
Patch guidance
Consult your Linux distribution's advisory or the upstream Linux kernel repositories for patch availability. The fix was merged into the mainline kernel to address this issue. Verify the specific kernel version number against vendor advisories (e.g., Red Hat, Ubuntu, Debian, SUSE) for the corresponding patched release. Test patches in a non-production environment before deployment. For systems unable to update immediately, consider restricting BPF program loading via sysctl (kernel.unprivileged_bpf_disabled = 2) or AppArmor/SELinux policies to reduce attack surface.
Detection guidance
Monitor kernel logs for NULL pointer dereference panic messages originating from unix_stream_bpf_update_proto() or the BPF sockmap path. A crash will appear as a hard kernel fault with a register dump pointing to address 0x0 or the null-dereference offset. Alerting on unexpected kernel panics related to BPF operations can surface exploitation attempts. Additionally, log all BPF program loading attempts (audit: -a always,exit -F arch=x86_64 -S bpf, etc.) to correlate suspicious program loads with subsequent crashes.
Why prioritize this
Although CVSS is MEDIUM (5.5), the practical impact is denial of service to the entire system via kernel panic. For production systems, especially those hosting multi-tenant workloads or relying on BPF for networking or security policy, rapid patching is warranted. The narrow race window means crashes may occur sporadically, making the vulnerability difficult to diagnose without kernel symbols. Systems with high availability requirements should prioritize this patch. Conversely, systems with strict BPF loading restrictions and no dynamic eBPF workloads may defer patching if they can tolerate the residual risk.
Risk score, explained
The CVSS 3.1 score of 5.5 is driven by: (1) Attack Vector = Local (reduces severity), (2) Privileges Required = Low (BPF capabilities are required, not full root), (3) Confidentiality = None (no data disclosure), (4) Integrity = None (no data corruption), (5) Availability = High (kernel panic is a complete availability loss). The score appropriately reflects the local boundary and privilege requirements while acknowledging the severe availability impact. Real-world risk may be higher for systems permitting unprivileged BPF or lower for air-gapped systems with strict BPF controls.
Frequently asked questions
Can this vulnerability be exploited remotely?
No. The vulnerability requires local access to the system and the ability to load BPF programs. Remote attackers cannot trigger it directly. However, if a container orchestration platform (e.g., Kubernetes) dynamically loads BPF programs from untrusted sources, a remote threat actor could indirectly cause exploitation.
Does this affect systems with unprivileged BPF disabled?
If kernel.unprivileged_bpf_disabled is set to 2 (CAP_BPF and CAP_PERFMON required), the attack surface is limited to privileged local processes. Setting unprivileged_bpf_disabled = 1 is a reasonable mitigation for systems that do not require unprivileged BPF functionality.
What is the practical impact of a crash caused by this vulnerability?
A successful exploit triggers a kernel NULL pointer dereference, causing an immediate kernel panic. The entire system will crash and require a reboot. This is a complete denial of service affecting all running services and workloads on that host.
Are there any workarounds if I cannot patch immediately?
Yes. Restrict BPF program loading via sysctl (kernel.unprivileged_bpf_disabled = 2), enforce SELinux or AppArmor policies that deny BPF loading to untrusted subjects, or disable dynamic BPF loading in container runtimes. These mitigations reduce exposure but do not resolve the underlying bug.
This analysis is provided for informational and risk assessment purposes. The technical details are based on the CVE description and kernel commit materials. Verify all patch versions, affected kernel releases, and remediation steps against official vendor advisories before deploying mitigations. No exploit code or proof-of-concept is provided. Organizations should conduct their own vulnerability assessment in their specific environment and consult with their security team or vendor for guidance tailored to their infrastructure and risk tolerance. Source: NVD (public-domain), retrieved 2026-07-31. Analysis generated by SEC.co (claude-haiku-4-5).
Related vulnerabilities
- CVE-2025-71313MEDIUMLinux Kernel PCI Endpoint NULL Pointer Dereference
- CVE-2026-46118MEDIUMLinux Kernel PAPR Hypervisor Pipe Null Pointer Dereference (POWER Systems)
- CVE-2026-46127MEDIUMLinux Kernel OCRDMA Null Pointer Dereference (DoS)
- CVE-2026-46134MEDIUMLinux Kernel cros_ec Mutex Initialization DoS Vulnerability
- CVE-2026-46188MEDIUMLinux Octeon EP VF NULL Pointer Dereference Denial of Service
- CVE-2026-46211MEDIUMLinux Kernel MSM DRM NULL Pointer and Silent Error in gem_info_get_metadata
- CVE-2026-46216MEDIUMLinux Intel Arc GPU NULL Pointer Dereference (HDCP)
- CVE-2026-46222MEDIUMLinux Rockchip RKCam Driver Null Pointer Dereference