af_unix: Don't leave consecutive consumed OOB skbs.
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 314001f0bf927015e459c9d387d62a231fe93af3 · < 32ca245464e1479bfea8592b9db227fdc1641705| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
af_unix: Don't leave consecutive consumed OOB skbs.
Jann Horn reported a use-after-free in unix_stream_read_generic().
The following sequences reproduce the issue:
$ python3 from socket import * s1, s2 = socketpair(AF_UNIX, SOCK_STREAM) s1.send(b'x', MSG_OOB) s2.recv(1, MSG_OOB) # leave a consumed OOB skb s1.send(b'y', MSG_OOB) s2.recv(1, MSG_OOB) # leave a consumed OOB skb s1.send(b'z', MSG_OOB) s2.recv(1) # recv 'z' illegally s2.recv(1, MSG_OOB) # access 'z' skb (use-after-free)
Even though a user reads OOB data, the skb holding the data stays on the recv queue to mark the OOB boundary and break the next recv().
After the last send() in the scenario above, the sk2's recv queue has 2 leading consumed OOB skbs and 1 real OOB skb.
Then, the following happens during the next recv() without MSG_OOB
From the CVE record · Linux
The Linux kernel's AF_UNIX stream receive path has a use-after-free involving consecutive consumed out-of-band socket buffers. A local process can trigger it through a sequence of socket send and receive calls; the input does not specify an authentication requirement or interaction with another user.
Engineers running the Linux kernel should check their versions against the vendor advisory; affected versions are not specified in the input.