MEDIUM 5.5

CVE-2026-52938 Linux Kernel BPF Socket Storage NULL Pointer Dereference

A flaw in the Linux kernel's BPF (Berkeley Packet Filter) socket storage mechanism can cause a system crash when the kernel tries to access memory that no longer exists. The vulnerability occurs during a race condition where one part of the kernel clears a reference to storage data while another part is simultaneously trying to read it, resulting in a NULL pointer dereference. This affects scenarios where socket cloning happens during TCP connection establishment and when diagnostic tools query BPF socket storage. The issue is local to the system and requires user-level privilege to trigger.

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
3 configuration(s)
Published / Modified
2026-06-24 / 2026-07-08

NVD description (verbatim)

In the Linux kernel, the following vulnerability has been resolved: bpf: Fix NULL pointer dereference in bpf_sk_storage_clone and diag paths bpf_selem_unlink_nofail() sets SDATA(selem)->smap to NULL before removing the selem from the storage hlist. A concurrent RCU reader in bpf_sk_storage_clone() can observe the selem still on the list with smap already NULL, causing a NULL pointer dereference. general protection fault, probably for non-canonical address 0xdffffc000000000a: KASAN: null-ptr-deref in range [0x0000000000000050-0x0000000000000057] RIP: 0010:bpf_sk_storage_clone+0x1cd/0xaa0 net/core/bpf_sk_storage.c:174 Call Trace: <IRQ> sk_clone+0xfed/0x1980 net/core/sock.c:2591 inet_csk_clone_lock+0x30/0x760 net/ipv4/inet_connection_sock.c:1222 tcp_create_openreq_child+0x35/0x2680 net/ipv4/tcp_minisocks.c:571 tcp_v4_syn_recv_sock+0x123/0xf90 net/ipv4/tcp_ipv4.c:1729 tcp_check_req+0x8e1/0x2580 include/net/tcp.h:855 tcp_v4_rcv+0x1845/0x3b80 net/ipv4/tcp_ipv4.c:2347 Add a NULL check for smap in bpf_sk_storage_clone(). bpf_sk_storage_diag_put_all() has the same issue. Add a NULL check and pass the validated smap directly to diag_get(), which is refactored to take smap as a parameter instead of reading it internally. bpf_sk_storage_diag_put() uses diag->maps[i] which is always valid under its refcount, so diag->maps[i] is passed directly to diag_get().

2 reference(s) · View on NVD →

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

Technical summary

CVE-2026-52938 addresses a use-after-free style race condition in net/core/bpf_sk_storage.c. The function bpf_selem_unlink_nofail() nullifies the SDATA(selem)->smap pointer before removing the selem from the storage hlist, creating a window where concurrent RCU readers in bpf_sk_storage_clone() can observe a list entry with a NULL smap. This manifests as a general protection fault when the code attempts to dereference the null smap pointer at offset 0x50. The issue also exists in bpf_sk_storage_diag_put_all(), which shares the same pattern. The fix introduces NULL checks in bpf_sk_storage_clone() and refactors bpf_sk_storage_diag_put_all() to validate smap before passing it to diag_get(), reducing the window for the race condition.

Business impact

This vulnerability can cause kernel panics on systems with BPF socket storage in active use, leading to unexpected system downtime and denial of service. Organizations relying on containerization, Kubernetes, or advanced networking tools that leverage eBPF extensively face elevated risk. While local privilege is required to exploit this, the impact is severe for multi-tenant environments or systems where unprivileged users have legitimate access to network functionality.

Affected systems

The Linux kernel is affected. The vulnerability is present in BPF socket storage code paths activated during TCP socket cloning and diagnostic operations. Systems running kernels with BPF support enabled and active socket storage operations are at risk. Verify the specific kernel version against the vendor's patch advisories, as the fix requires kernel update to a patched version.

Exploitability

Exploitation requires local access and unprivileged user privilege level. The race condition is inherently probabilistic, dependent on timing between socket cloning and storage cleanup, making reliable triggering non-trivial. However, workloads with high connection churn or continuous socket cloning can increase the likelihood of triggering the NULL dereference. No known public exploits exist as this is a kernel stability issue rather than a traditional privilege escalation or code execution vector.

Remediation

Update the Linux kernel to a patched version that includes the NULL pointer checks and diag_get() refactoring. Kernel maintainers have released fixes addressing both bpf_sk_storage_clone() and bpf_sk_storage_diag_put_all() code paths. Consult your Linux distribution's security advisories for specific patched kernel versions. Interim mitigation is limited; disabling BPF socket storage is not practical for most deployments.

Patch guidance

Apply kernel updates from your distribution as soon as available. The fix is relatively small and surgical—adding NULL checks and refactoring the diag function parameter passing—so patch deployments should not introduce new regressions. Test patched kernels in staging environments before production rollout, particularly if your workload relies heavily on eBPF or runs containerized services with BPF hooks.

Detection guidance

Monitor kernel logs for general protection faults or KASAN reports mentioning bpf_sk_storage_clone or bpf_sk_storage_diag_put_all. In production, watch for unexpected kernel panics during periods of high socket creation or TCP connection churn. Systems running kernel address sanitizer (KASAN) builds will surface this issue more reliably. Correlate crashes with eBPF program activity and container orchestration events.

Why prioritize this

This CVSS 5.5 MEDIUM vulnerability should be prioritized for patching in production environments with heavy BPF usage or frequent socket cloning (e.g., Kubernetes nodes, load balancers, container hosts). The local-only requirement and need for user privilege reduce criticality, but the kernel crash impact justifies prompt remediation. Organizations should defer patching only if they can confirm BPF socket storage is not in active use.

Risk score, explained

The CVSS 3.1 score of 5.5 reflects a local attack vector with low complexity, unprivileged access, and high availability impact (kernel crash). There is no confidentiality or integrity impact. The score appropriately balances the severe crash consequence against the requirement for local access and timing-dependent exploitation. Real-world risk is elevated for infrastructure serving multiple tenants or running container orchestration.

Frequently asked questions

Can this be exploited remotely?

No. The vulnerability requires local system access and unprivileged user privilege. It cannot be triggered over the network.

Does this affect all Linux kernels?

Only kernels with BPF support compiled in and socket storage operations active. Check your kernel configuration and running eBPF programs. Embedded systems or minimal kernels may not be affected.

What is the difference between the bpf_sk_storage_clone and diag_put_all fixes?

Both paths had the same race condition but were fixed differently. bpf_sk_storage_clone() now includes a NULL check before dereferencing smap. bpf_sk_storage_diag_put_all() was refactored to validate smap upfront and pass it directly to diag_get(), eliminating the internal read of a potentially stale pointer.

If I disable BPF, does this vulnerability disappear?

Yes, disabling BPF at build time or boot time would eliminate exposure. However, most production environments require BPF for container networking, observability, and security tools, making this impractical as a long-term mitigation.

This analysis is based on disclosed information current as of the publication date. Patch version numbers, specific affected kernel versions, and vendor advisories should be verified against official Linux distribution security bulletins. This vulnerability requires local access and does not provide remote code execution. No working exploit code is publicly available. Organizations should test patches in non-production environments before deployment. Source: NVD (public-domain), retrieved 2026-07-30. Analysis generated by SEC.co (claude-haiku-4-5).