CVE-2024-26923

Severity CVSS v4.0:
Pending analysis
Type:
CWE-362 Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
Publication date:
25/04/2024
Last modified:
23/12/2025

Description

In the Linux kernel, the following vulnerability has been resolved:<br /> <br /> af_unix: Fix garbage collector racing against connect()<br /> <br /> Garbage collector does not take into account the risk of embryo getting<br /> enqueued during the garbage collection. If such embryo has a peer that<br /> carries SCM_RIGHTS, two consecutive passes of scan_children() may see a<br /> different set of children. Leading to an incorrectly elevated inflight<br /> count, and then a dangling pointer within the gc_inflight_list.<br /> <br /> sockets are AF_UNIX/SOCK_STREAM<br /> S is an unconnected socket<br /> L is a listening in-flight socket bound to addr, not in fdtable<br /> V&amp;#39;s fd will be passed via sendmsg(), gets inflight count bumped<br /> <br /> connect(S, addr) sendmsg(S, [V]); close(V) __unix_gc()<br /> ---------------- ------------------------- -----------<br /> <br /> NS = unix_create1()<br /> skb1 = sock_wmalloc(NS)<br /> L = unix_find_other(addr)<br /> unix_state_lock(L)<br /> unix_peer(S) = NS<br /> // V count=1 inflight=0<br /> <br /> NS = unix_peer(S)<br /> skb2 = sock_alloc()<br /> skb_queue_tail(NS, skb2[V])<br /> <br /> // V became in-flight<br /> // V count=2 inflight=1<br /> <br /> close(V)<br /> <br /> // V count=1 inflight=1<br /> // GC candidate condition met<br /> <br /> for u in gc_inflight_list:<br /> if (total_refs == inflight_refs)<br /> add u to gc_candidates<br /> <br /> // gc_candidates={L, V}<br /> <br /> for u in gc_candidates:<br /> scan_children(u, dec_inflight)<br /> <br /> // embryo (skb1) was not<br /> // reachable from L yet, so V&amp;#39;s<br /> // inflight remains unchanged<br /> __skb_queue_tail(L, skb1)<br /> unix_state_unlock(L)<br /> for u in gc_candidates:<br /> if (u.inflight)<br /> scan_children(u, inc_inflight_move_tail)<br /> <br /> // V count=1 inflight=2 (!)<br /> <br /> If there is a GC-candidate listening socket, lock/unlock its state. This<br /> makes GC wait until the end of any ongoing connect() to that socket. After<br /> flipping the lock, a possibly SCM-laden embryo is already enqueued. And if<br /> there is another embryo coming, it can not possibly carry SCM_RIGHTS. At<br /> this point, unix_inflight() can not happen because unix_gc_lock is already<br /> taken. Inflight graph remains unaffected.

Vulnerable products and versions

CPE From Up to
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 2.6.23 (including) 4.19.314 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 4.20 (including) 5.4.275 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 5.5 (including) 5.10.216 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 5.11 (including) 5.15.156 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 5.16 (including) 6.1.87 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 6.2 (including) 6.6.28 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 6.7 (including) 6.8.7 (excluding)
cpe:2.3:o:linux:linux_kernel:6.9:rc1:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.9:rc2:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.9:rc3:*:*:*:*:*:*
cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*