CVE-2024-53186·Kernel vulnerability
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 `ksmbd_conn_handler_loop()` and the freeing of `ksmbd_conn` in the workqueue handler `handle_ksmbd_work()`. This leads to a UAF. - KASAN: slab-use-after-free Read in handle_ksmbd_work - KASAN: slab-use-after-free in rtlock_slowlock_locked This race condition arises as follows: - `ksmbd_conn_handler_loop()` waits for `conn->r_count` to reach zero: `wait_event(conn->r_count_q, atomic_read(&conn->r_count) == 0);` - Meanwhile, `handle_ksmbd_work()` decrements `conn->r_count` using `atomic_dec_return(&conn->r_count)`, and if it reaches zero, calls `ksmbd_conn_free()`, which frees `conn`. - However, after `handle_ksmbd_work()` decrements `conn->r_count`, it may still access `conn->r_count_q` in the following line: `waitqueue_active(&conn->r_count_q)` or `wake_up(&conn->r_count_q)` 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.
- Severity
- high
- Software
- Kernel
- Fixed in
- 6.12.2
- Published
- 2024-12-27
Affected versions
From: 6.12
Until: 6.12.2
Fixed in: 6.12.2
How to fix this CVE
Update your Linux kernel to version 6.12.2 or later to resolve a critical use-after-free vulnerability in the ksmbd SMB server component. This race condition could allow local attackers with kernel-level access to trigger memory corruption through specially timed SMB requests. Prioritize this patch for systems exposing SMB services, particularly in file server and NAS deployments.
sudo dnf update kernel kernel-develDefensia detects this vulnerability
How to check if you are affected
- Check kernel version: uname -r — Vulnerable if output shows 6.12.0, 6.12.1, or 6.12.2 before the patch date
- Verify ksmbd is loaded: lsmod | grep ksmbd — If output is empty, ksmbd is not active; if present, the system is potentially exposed
- Search kernel logs for UAF indicators: sudo dmesg | grep -iE 'use-after-free|ksmbd|rtlock_slowlock' — Look for KASAN reports mentioning handle_ksmbd_work
- Confirm patch application: grep -i 'CONFIG_SMB_SERVER' /boot/config-$(uname -r) — Should show CONFIG_SMB_SERVER=m or CONFIG_SMB_SERVER=y; then verify kernel build timestamp is after the fix commit date
FAQ
What is CVE-2024-53186?
CVE-2024-53186 is a use-after-free (UAF) vulnerability in the Linux kernel's ksmbd SMB server that arises from improper synchronization between the request handler loop and the workqueue handler, allowing memory corruption after freeing connection structures.
Is CVE-2024-53186 being actively exploited?
No, CVE-2024-53186 is not listed in CISA's Known Exploited Vulnerabilities (KEV) catalog and no public exploits are currently available, though the vulnerability requires local access to trigger.
What versions of Kernel are affected by CVE-2024-53186?
Linux kernel versions 6.12.0, 6.12.1, and 6.12.2 (prior to the patch) are affected; the vulnerability was patched in kernel 6.12.2+ with commits 96261adb998a, 9a8c5d89d327, a96f9eb7add3, and f20b77f7897e.
How do I check if my server is vulnerable to CVE-2024-53186?
Run uname -r and compare the output against the affected version range (6.12.0–6.12.2); then verify ksmbd is enabled with lsmod | grep ksmbd to determine exposure.
Does Defensia detect CVE-2024-53186?
Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If Linux kernel is installed on a monitored server, CVE-2024-53186 will appear in your dashboard with remediation steps.
Related Kernel CVEs
References
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2024-53186. Free for 1 server.
Get started free