CVE-2025-37952
High · 8.8CVSS
8.8
EPSS
0.4%
Published
May 20, 2025
CISA due date
—
Cloudanix analysis
A flaw in the Linux kernel's file-sharing code can let an attacker crash the system or gain higher privileges by tricking it into using memory that has already been freed.
- Exploitation
- Remote Authenticated
- Attacker needs
- Low Privilege
- Complexity
- Moderate
- Impact
- Full Compromise
- Component
- OS kernel
- Class
- Memory Corruption
- Remediation
- Patch
- Effort
- Medium
- Patch risk
- Low
What it actually does
Use-after-free in ksmbd due to insufficient refcount protection on fp objects in __close_file_table_ids, allowing one thread to free a file descriptor while another concurrently retrieves it via the IDR without holding ft->lock.
Why it matters to the business
Kernel memory corruption on Linux systems hosting SMB shares can cause crashes, denial of service, or local privilege escalation, disrupting file services and exposing the host to further compromise.
How an attack unfolds
An attacker with network access to ksmbd or local code execution triggers a race between __ksmbd_close_fd and functions that fetch file pointers from the IDR; concurrent threads acquire the same dangling pointer after one frees it, leading to memory corruption. Similar kernel privilege-escalation patterns seen in related CVEs demonstrate how this can be chained for root access.
How to fix it
Apply the upstream fix in commit fec1f9e9a650e8e7011330a085c77e7bf2a08ea9 or later stable kernels; rebuild and reboot with the patched kernel. Disable ksmbd if SMB services are not required.
How to confirm the fix worked
Confirm the running kernel contains commit fec1f9e9a650e8e7011330a085c77e7bf2a08ea9 via git log or uname -r against a known fixed distribution build; attempt to reproduce the race under load to verify absence of UAF.
Typical attack path
- Establish SMB session to ksmbd
- Trigger concurrent file open/close operations from multiple threads or connections
- Race __close_file_table_ids removal against IDR lookup paths
- Reuse freed file pointer to corrupt kernel memory structures
- Escalate privileges or crash the kernel
How to detect it
Review kernel logs for oops/panic messages referencing ksmbd, __close_file_table_ids, or IDR file table operations; correlate with SMB connection spikes and audit user-space processes performing rapid file operations on SMB shares.
- ksmbd: __close_file_table_ids
- UAF in ksmbd file table
- ft->lock ksmbd
- kernel BUG at fs/smb/server/vfs.c
What your security team should do
- Immediately upgrade affected kernels to a version containing fec1f9e9a650e8e7011330a085c77e7bf2a08ea9
- Restrict ksmbd exposure to trusted networks only
- Monitor for related kernel memory corruption reports in ksmbd
- Plan kernel updates within the next maintenance window given the 500+ days since disclosure
The record
In the Linux kernel, the following vulnerability has been resolved: ksmbd: Fix UAF in __close_file_table_ids A use-after-free is possible if one thread destroys the file via __ksmbd_close_fd while another thread holds a reference to it. The existing checks on fp->refcount are not sufficient to prevent this. The fix takes ft->lock around the section which removes the file from the file table. This prevents two threads acquiring the same file pointer via __close_file_table_ids, as well as the other functions which retrieve a file from the IDR and which already use this same lock.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Debian:12 | linux | 0 | No fix |
| Debian:13 | linux | 0 | No fix |
| Debian:13 | linux | 0 | 6.12.29-1 |
| Linux | Kernel | 5.15.0 | 6.6.91 |
| Mageia:9 | dwarves | 0 | 1.30-1.mga9 |
| Mageia:9 | kernel | 0 | 6.6.93-1.mga9 |
| Mageia:9 | kernel-firmware | 0 | 20250509-1.mga9 |
| Mageia:9 | kernel-firmware-nonfree | 0 | 20250509-1.mga9.nonfree |
| Mageia:9 | kernel-linus | 0 | 6.6.93-1.mga9 |
| Mageia:9 | kmod-virtualbox | 0 | 7.1.8-3.mga9 |
| Mageia:9 | kmod-xtables-addons | 0 | 3.24-80.mga9 |
| Mageia:9 | libtraceevent | 0 | 1.8.4-1.mga9 |
| Mageia:9 | libtracefs | 0 | 1.8.2-1.mga9 |
| Mageia:9 | radeon-firmware | 0 | 20250509-1.mga9.nonfree |
| Mageia:9 | wireless-regdb | 0 | 20250220-1.mga9 |
Related vulnerabilities
- CVE-2025-39885 In the Linux kernel, the following vulnerability has been resolved: ocfs2: fix recursive… Also affects linux
- CVE-2025-39883 In the Linux kernel, the following vulnerability has been resolved: mm/memory-failure… Also affects linux
- CVE-2025-39886 In the Linux kernel, the following vulnerability has been resolved: bpf: Tell memcg to… Also affects linux
- CVE-2025-39876 In the Linux kernel, the following vulnerability has been resolved: net: fec: Fix… Also affects linux
- CVE-2025-39880 In the Linux kernel, the following vulnerability has been resolved: libceph: fix invalid… Also affects linux
- CVE-2025-39881 In the Linux kernel, the following vulnerability has been resolved: kernfs: Fix UAF in… Also affects linux
- CVE-2025-39877 In the Linux kernel, the following vulnerability has been resolved: mm/damon/sysfs: fix… Also affects linux
- CVE-2025-39871 In the Linux kernel, the following vulnerability has been resolved: dmaengine: idxd… Also affects linux