PT-2026-61426 · Linux · Linux
CVE-2026-64109
·
Publicado
2026-07-19
·
Atualizado
2026-07-19
CVSS v3.1
8.8
Alta
| Vetor | 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:static int socks[2];
void test setup(void) {
socketpair(AF UNIX, SOCK STREAM, 0, socks);
send(socks[1], "A", 1, 0);
int peekoff = 1;
setsockopt(socks[0], SOL SOCKET, SO PEEK OFF, &peekoff, sizeof(peekoff));
}
void test thread1(void) {
char dummy;
recv(socks[0], &dummy, 1, MSG PEEK);
}
void test thread2(void) {
char dummy;
recv(socks[0], &dummy, 1, 0);
shutdown(socks[1], SHUT WR);
}when racing like this:
thread1 thread2
unix stream read generic
mutex lock(&u->iolock)
skb peek(&sk->sk receive queue)
skb peek next(skb, &sk->sk receive queue)
mutex unlock(&u->iolock)
unix stream read generic
unix state lock(sk)
skb peek(&sk->sk receive queue)
unix state unlock(sk)
unix stream data wait
unix state lock(sk)
tail = skb peek tail(&sk->sk receive queue)
spin lock(&sk->sk receive queue.lock)
skb unlink(skb, &sk->sk receive queue)
spin unlock(&sk->sk receive queue.lock)
consume skb(skb) [frees the SKB]
`tail != last`: false
`tail`: true
`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.
Correção
Encontrou algum problema na descrição? Tem algo a acrescentar? Fique à vontade para nos escrever 👾
Identificadores relacionados
Produtos afetados
Linux