In the Linux kernel, the following vulnerability has been resolved: af_unix: Fix UAF read of tail->len in unix_stream_data_wait() unix_str
위협 신호 · CVSS · EPSS · KEV
이론적 심각도 점수
30일 내 악용 확률 예측
실측 악용 기록 없음
별도 긴급 패치 불필요 — 정기 시스템 업그레이드 주기에 맞춰 조치
CVSS 벡터 · 메트릭
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H상세 설명
In the Linux kernel, the following vulnerability has been resolved:
af_unix: Fix UAF read of tail->len in unix_stream_data_wait()
unix_stream_data_wait() does skb_peek_tail(&sk->sk_receive_queue) without
holding any lock that prevents SKBs on that queue from being dequeued and
freed.
This has been the case since commit 79f632c71bea ("unix/stream: fix
peeking with an offset larger than data in queue").
The first consequence of this is that the pointer comparison
tail != last can be false even if last semantically refers to an
already-freed SKB while tail is a new SKB allocated at the same address;
which can cause unix_stream_data_wait() to wrongly keep blocking after new
data has arrived, but only in a weird scenario where a peeking recv() and
a normal recv() on the same socket are racing, which is probably not a
real problem.
But since commit 2b514574f7e8 ("net: af_unix: implement splice for stream
af_unix sockets"), tail is actually dereferenced, which can cause UAF in
the following race scenario (where test_setup() runs single-threaded,
and afterwards, test_thread1() and test_thread2() run concurrently in
two threads:
1static int socks[2]; 2void test_setup(void) { 3 socketpair(AF_UNIX, SOCK_STREAM, 0, socks); 4 send(socks[1], "A", 1, 0); 5 int peekoff = 1; 6 setsockopt(socks[0], SOL_SOCKET, SO_PEEK_OFF, &peekoff, sizeof(peekoff)); 7} 8void test_thread1(void) { 9 char dummy;10 recv(socks[0], &dummy, 1, MSG_PEEK);11}12void test_thread2(void) {13 char dummy;14 recv(socks[0], &dummy, 1, 0);15 shutdown(socks[1], SHUT_WR);16}when racing like this:
1thread1 thread2 2unix_stream_read_generic 3 mutex_lock(&u->iolock) 4 skb_peek(&sk->sk_receive_queue) 5 skb_peek_next(skb, &sk->sk_receive_queue) 6 mutex_unlock(&u->iolock) 7 unix_stream_read_generic 8 unix_state_lock(sk) 9 skb_peek(&sk->sk_receive_queue)10 unix_state_unlock(sk)11 unix_stream_data_wait12 unix_state_lock(sk)13 tail = skb_peek_tail(&sk->sk_receive_queue)14 spin_lock(&sk->sk_receive_queue.lock)15 __skb_unlink(skb, &sk->sk_receive_queue)16 spin_unlock(&sk->sk_receive_queue.lock)17 consume_skb(skb) [frees the SKB]18 `tail != last`: false19 `tail`: true20 `tail->len != last_len` ***UAF***Fix the UAF by removing the read of tail->len; checking tail->len would
only make sense if SKBs in the receive queue of a UNIX socket could grow,
which can no longer happen.
Kuniyuki explained:
When commit 869e7c62486e ("net: af_unix: implement stream sendpage
support") added sendpage() support, data could be appended to the last
skb in the receiver's queue.That's why we needed to check if the length of the last skb was changed
while waiting for new data in unix_stream_data_wait().However, commit a0dbf5f818f9 ("af_unix: Support MSG_SPLICE_PAGES") and
commit 57d44a354a43 ("unix: Convert unix_stream_sendpage() to use
MSG_SPLICE_PAGES") refactored sendmsg(), and now data is always added
to a new skb.
That means this fix is not suitable for kernels before 6.5.
AI 심층 분석
공격 시나리오 · 재현 가능한 PoC 페이로드 · 즉시 적용 가능한 차단 패치를 한 번에 받아 보세요. 보안 운영팀이 그대로 점검·티켓팅에 쓸 수 있는 형태로 정리해 드립니다.
참고 자료 5
링크 내용 불러오는 중…