Information on use-after-free in smb2_is_status_io_timeout()?
Subsystems (2)
Hi,
There is a Red Hat bugzilla report in
https://bugzilla.redhat.com/show_bug.cgi?id=2154178 about a use-after-free in smb2_is_status_io_timeout() . While the commit noted initially there seems not correct, Ben Hutchings raised a question on more information in
https://bugzilla.redhat.com/show_bug.cgi?id=2154178#c24 .
(there is a CVE assigned for it, CVE-2023-1192)
To quote the initial message in RHBZ#2154178:
Quoted 5 lines
A use after free flaw was found in
smb2_is_status_io_timeout()in CIFS in the Linux Kernel. After CIFS transfers response data to system call, there is still a local variable points to the memory region, and if system call frees it faster than CIFS uses it, CIFS will access a free memory region leading to a denial of service.
Ben asked:
Quoted 22 lines
smb2_is_status_io_timeout()is only ever called fromcifs_demultiplex_thread(). That happens after it conditionally decrypts the original receive buffer (buf) into one or more new buffers (bufs[...]), or otherwise sets bufs[0] = buf. The decryption process looks like it can free the original buffer, resulting in the reported UAF.If the error code is part of the encrypted payload, then I think the check for an I/O timeout should use bufs[0] like other code further down the function:
fs/smb/client/connect.c +1
-2@@ -1236,7 +1236,7 @@ cifs_demultiplex_thread(void *p) }if (server->ops->is_status_io_timeout && - server->ops->is_status_io_timeout (buf)) { + server->ops->is_status_io_timeout (bufs[0 ])) { num_io_timeout++;if (num_io_timeout >MAX_STATUS_IO_TIMEOUT ) { cifs_server_dbg(VFS, --- END ---
Quoted 4 lines
If the error code does not get encrypted, then the timeout check needs to be done further up the function.
Does anyone have a reproducer for this?
Does anyone knows more on this issue?
Regards,
Salvatore
Quoted 8 lines · Salvatore Bonaccorso
There is a Red Hat bugzilla report in
https://bugzilla.redhat.com/show_bug.cgi?id=2154178 about a use-after-free insmb2_is_status_io_timeout(). While the commit noted initially there seems not correct, Ben Hutchings raised a question on more information in
https://bugzilla.redhat.com/show_bug.cgi?id=2154178#c24 .(there is a CVE assigned for it, CVE-2023-1192)
That is supposed to be fixed by
d527f51331ca ("cifs: Fix UAF in cifs_demultiplex_thread()")While the commit refers to an UAF in ->is_network_name_deleted(), this should also work for smb2_is_status_io_timeout(), AFAICT.
Quoted 9 lines · Paulo Alcantara
Quoted 7 lines · Salvatore Bonaccorso
There is a Red Hat bugzilla report in
https://bugzilla.redhat.com/show_bug.cgi?id=2154178 about a use-after-free insmb2_is_status_io_timeout(). While the commit noted initially there seems not correct, Ben Hutchings raised a question on more information in
https://bugzilla.redhat.com/show_bug.cgi?id=2154178#c24 .
Quoted 8 lines
Quoted 1 line
(there is a CVE assigned for it, CVE-2023-1192)
That is supposed to be fixed by
d527f51331ca ("cifs: Fix UAF in cifs_demultiplex_thread()")While the commit refers to an UAF in ->is_network_name_deleted(), this should also work for
smb2_is_status_io_timeout(), AFAICT.
I think that's a different UAF bug that happens to affect the same function.
Ben.
Signature · 2 lines
Ben Hutchings - Debian developer, member of kernel, installer and LTS teams