CVE-2025-38051 Overview
CVE-2025-38051 is a use-after-free vulnerability [CWE-416] in the Linux kernel's SMB/CIFS client, specifically in the cifs_fill_dirent function. A race condition in the readdir concurrency path allows a thread to access the SMB response (rsp) buffer after it has been released by a concurrent operation. The flaw was surfaced by a Kernel Address Sanitizer (KASAN) slab-use-after-free report on kernel 6.15.0-rc6 and affects multiple stable branches including the 6.15 release candidates. Successful exploitation can lead to kernel memory corruption, information disclosure, or denial of service on systems mounting CIFS/SMB shares.
Critical Impact
Local attackers with the ability to trigger concurrent directory reads on a mounted CIFS share can corrupt kernel memory, potentially crashing the host or escalating privileges.
Affected Products
- Linux kernel (multiple stable branches, including 6.15-rc1 through 6.15-rc7)
- Debian Linux 11.0 (Bullseye) and Debian LTS distributions
- Any Linux distribution using the vulnerable cifs.ko client module
Discovery Timeline
- 2025-06-18 - CVE-2025-38051 published to NVD
- 2026-07-30 - Last updated in NVD database
Technical Details for CVE-2025-38051
Vulnerability Analysis
The defect resides in the CIFS client code responsible for populating directory entries during getdents/getdents64 system calls. When two threads iterate a directory on the same mount, one thread can free the response buffer allocated via cifs_buf_get while another thread is still dereferencing pointers into that buffer inside cifs_fill_dirent. The KASAN report shows a 4-byte read at offset 412 into a 16,588-byte cifs_request slab object that was previously released by cifs_buf_release in cifs_readdir. Because the freed memory belongs to a slab cache that is quickly recycled, an attacker may spray replacement objects to influence the contents read by the racing thread.
Root Cause
The root cause is missing synchronization around the lifetime of the SMB response buffer referenced during directory iteration. The cifs_readdir code path releases the buffer through cifs_buf_release on one CPU while cifs_fill_dirent on another CPU continues to walk directory records inside the same buffer. There is no reference count or lock that ties the buffer's lifetime to the completion of all consumers, producing a classic use-after-free race.
Attack Vector
Exploitation requires local access and the ability to issue directory read operations against a mounted CIFS/SMB share. An attacker runs concurrent getdents64 syscalls against the share to trigger the race. The vulnerability has high attack complexity because timing is required to interleave the free with the in-flight read. When the race succeeds, the attacker reads freed kernel memory, which can be used to leak sensitive kernel data, cause a kernel panic, or, with heap-spray techniques, corrupt adjacent slab objects to influence control flow. The upstream commit series describes the fix; see the Linux kernel commit for details on the synchronization change.
Detection Methods for CVE-2025-38051
Indicators of Compromise
- Kernel logs containing KASAN: slab-use-after-free in cifs_fill_dirent on debug kernels, indicating active exploitation attempts.
- Unexpected kernel oopses, panics, or general protection faults referencing cifs_readdir, cifs_fill_dirent, or the cifs_request slab cache.
- Processes performing high-rate, concurrent getdents/getdents64 syscalls against a CIFS mount point from unprivileged users.
Detection Strategies
- Enable KASAN on test and staging kernels to catch use-after-free conditions during pre-production validation of CIFS workloads.
- Monitor dmesg and /var/log/kern.log for stack traces referencing cifs_fill_dirent+, cifs_readdir+, or cifs_buf_release+.
- Audit installed kernel versions against the fixed commit list published on git.kernel.org to identify unpatched hosts.
Monitoring Recommendations
- Collect kernel ring-buffer telemetry from all Linux hosts that mount SMB/CIFS shares and alert on KASAN or BUG: entries.
- Track syscall patterns from non-root users showing sustained parallel directory reads on CIFS mounts, which is atypical for most workloads.
- Forward host logs to a centralized SIEM or data lake and build correlation rules for CIFS client stack traces.
How to Mitigate CVE-2025-38051
Immediate Actions Required
- Update the Linux kernel to a version that includes the upstream fix commits listed on git.kernel.org (for example, a7a8fe56e932, 9c9aafbacc18, 1b197931fbc8).
- Apply the Debian LTS updates referenced in the Debian LTS Security Announcement and its companion advisory.
- Restrict which users can mount and access CIFS shares by tightening mount privileges and share export policies.
Patch Information
The fix is delivered as a series of stable-tree commits that add proper synchronization around the SMB response buffer during readdir. Distribution packages carrying the patch include Debian's linux package updates announced in October 2025 for supported LTS branches. Administrators should verify kernel package versions with uname -r and their distribution's package manager, then reboot to load the patched kernel and cifs.ko module.
Workarounds
- Unmount CIFS/SMB shares on hosts where the kernel cannot be immediately patched, or restrict mounts to trusted, non-shared systems.
- Limit multi-user concurrent access to CIFS mount points using filesystem permissions or namespace isolation until patches are applied.
- Blacklist the cifs kernel module on hosts that do not require SMB connectivity by adding blacklist cifs to /etc/modprobe.d/.
# Verify running kernel and check for the fixed cifs module
uname -r
modinfo cifs | grep -E 'version|filename'
# Debian/Ubuntu: apply security updates and reboot
sudo apt-get update
sudo apt-get install --only-upgrade linux-image-$(uname -r | sed 's/[^-]*-[^-]*-//')
sudo systemctl reboot
# Temporary hardening: disable the cifs module if SMB is not required
echo 'blacklist cifs' | sudo tee /etc/modprobe.d/disable-cifs.conf
sudo update-initramfs -u
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

