Premature socket free in Linux kernel BPF socket storage clone
Key facts
- Attack vector
- —
- Privileges required
- —
- User interaction
- —
- Attack complexity
- —
- Impact type
- —
- Confidentiality · integrity · availability
- —
- Fix status
- Fixed
No CVSS vector from any source. Fix status from CNA.
Summary
The Linux kernel from 5.11 is affected in its BPF socket storage code. When a socket is cloned, the copied storage elements are linked to their maps before the clone's sk_refcnt is cleared, so the count can hold a stale value. A BPF helper can then take a reference the clone does not own and drop one of the new socket's two references, freeing the socket too early.
Written with Claude Haiku 5.5 from the sources below · 2026-11-30
Description from the CNA
In the Linux kernel, the following vulnerability has been resolved: bpf: Clear sk_refcnt of a clone before its storage is linked sk_clone() sets sk_refcnt of the new socket some lines behind bpf_sk_storage_clone(). But the elements which that function copies are linked to their maps at once, and an element leads to its owner: the iterator over a sk_storage map hands the owner to its program. bpf_sk_storage_get() with BPF_SK_STORAGE_GET_F_CREATE and bpf_sk_storage_delete() rely on refcount_inc_not_zero() to tell whether they may touch the socket. sk_refcnt is in the part of struct sock which sock_copy() leaves out, and sk_prot_alloc() does not clear a clone unless init_on_alloc is on. It is zero in an object which has been a socket before, and anything in one which has not. If it is not zero, a helper gets a reference which refcount_set() wipes out, and the helper's sock_put() then drops one of the two references of the new socket, which is freed too early: IPv4: Attempt to release TCP socket in state 1 BUG: KASAN: slab-use-after-free in __raw_spin_lock_init+0x47/0x90 In the meantime the helper changes a storage which bpf_sk_storage_clone() fills without taking its lock. Nothing else can find the clone at this point. Say that it is not alive yet, before the first element is linked. Sockets whose parent has no storage are left alone.
Why it matters now
SSVC decision points
Not available: CISA has not published SSVC decision points for this record.
Affected products
Remediation
Upgrade to a fixed version: 5.15.226, 6.1.193, 6.6.163, 6.12.119, 6.18.65, 7.3.6 or 7.4-rc1.
Written with Claude Haiku 5.5 from the sources below · 2026-11-30
- Fix · CNA Linux (Linux) Fixed in 5.15.226, 6.1.193, 6.6.163, 6.12.119, 6.18.65, 7.3.6, 7.4-rc1
Timeline
- 2026-11-30 Threatist record created from CVE-2026-139313
- 2026-11-30 Alias added: GHSA-gw23-c93p-jx49
References
Other 7
- https://git.kernel.org/stable/c/fc6d7288e0521de69b6e130278563138551e5c7e
- https://git.kernel.org/stable/c/856649a34a66e1e485ecfee12d0f9e7f02896d52
- https://git.kernel.org/stable/c/1e49688900d8bddc0cf626ba5cc780c34b58ef58
- https://git.kernel.org/stable/c/a5b2375d755a6f7841ef25301bc824e089060454
- https://git.kernel.org/stable/c/28051395df6e8829f7f168c6eef4a4e411cbbc37
- https://git.kernel.org/stable/c/e43a39cdd14639bba5c7b66d1e99ea4948cec04c
- https://git.kernel.org/stable/c/22f100bd013458836c3d0eaf8050b854d7534a66
More Linux vulnerabilities
- TI-2025-26358 Zero-length TLS records mishandled on rx_list in Linux kernel KEVCVSS 3.1CRITICAL 9.8
- TI-2026-38352 Out-of-bounds write in Linux kernel ebtables SNAT ARP rewrite KEVCVSS 3.1HIGH 8.8
- TI-2021-02452 Overlayfs flaw in Linux kernel lets attackers gain elevated privileges KEVCVSS 3.1HIGH 8.8
- TI-2013-05264 Missing address checks in Linux kernel get_user and put_user on ARM KEVCVSS 3.1HIGH 8.8
- TI-2022-00125 Heap overflow in Linux kernel lets local users escalate privileges KEVCVSS 3.1HIGH 8.4
- TI-2013-01864 Wrong integer type in Linux kernel perf_swevent_init KEVCVSS 3.1HIGH 8.4
Sources
- CVE-2026-139313 · CVE Program
- CVE-2026-139313 · NVD
- GHSA-gw23-c93p-jx49 · GitHub Advisory Database · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences