CVE-2024-53186: ksmbd: fix use-after-free in SMB request handling
In the Linux kernel, the following vulnerability has been resolved:
ksmbd: fix use-after-free in SMB request handling
A race condition exists between SMB request handling in ksmbdconnhandlerloop() and the freeing of ksmbdconn in the workqueue handler handleksmbdwork(). This leads to a UAF. - KASAN: slab-use-after-free Read in handleksmbdwork - KASAN: slab-use-after-free in rtlockslowlocklocked
This race condition arises as follows: - ksmbdconnhandlerloop() waits for conn->rcount to reach zero: waitevent(conn->rcountq, atomicread(&conn->rcount) == 0); - Meanwhile, handleksmbdwork() decrements conn->rcount using atomicdecreturn(&conn->rcount), and if it reaches zero, calls ksmbdconnfree(), which frees conn. - However, after handleksmbdwork() decrements conn->rcount, it may still access conn->rcountq in the following line: waitqueueactive(&conn->rcountq) or wakeup(&conn->rcountq) This results in a UAF, as conn has already been freed.
The discovery of this UAF can be referenced in the following PR for syzkaller's support for SMB requests.
Affected Software
Event History
Frequently Asked Questions
What is the severity of CVE-2024-53186?
The severity of CVE-2024-53186 has not been explicitly assigned, but it is crucial to address due to its potential impact on system stability.
How do I fix CVE-2024-53186?
To fix CVE-2024-53186, update the Linux kernel to a version later than 6.6.64, 6.10.14, 6.11.3, or 6.12.
Which versions of the Linux kernel are affected by CVE-2024-53186?
CVE-2024-53186 affects Linux kernel versions from 6.6.55 to 6.6.64, 6.10.14 to 6.11, 6.11.3 to 6.11.11, and 6.12 to 6.12.2.
What type of vulnerability is CVE-2024-53186?
CVE-2024-53186 is identified as a use-after-free vulnerability caused by a race condition in SMB request handling.
What components are affected by CVE-2024-53186?
CVE-2024-53186 specifically affects the ksmbd component of the Linux kernel.