CVE-2024-56626 Overview
CVE-2024-56626 is an out-of-bounds write vulnerability [CWE-787] in the Linux kernel's ksmbd in-kernel SMB3 server. The flaw resides in the ksmbd_vfs_stream_write function, which fails to validate that the client-supplied offset is non-negative before writing data. A negative offset value causes data to be written outside the bounds of the allocated buffer, leading to kernel memory corruption. The issue is only reachable when vfs objects = streams_xattr is set in ksmbd.conf. An authenticated local attacker with low privileges can exploit the condition to escalate privileges, corrupt kernel memory, or trigger denial of service.
Critical Impact
Authenticated attackers with access to a ksmbd share configured with streams_xattr can write outside the allocated buffer in kernel space, enabling privilege escalation and full system compromise.
Affected Products
- Linux Kernel (multiple stable branches prior to the patch commits)
- Linux Kernel 6.13-rc1
- Debian LTS distributions shipping the affected kernel
Discovery Timeline
- 2024-12-27 - CVE-2024-56626 published to NVD
- 2025-11-03 - Last updated in NVD database
Technical Details for CVE-2024-56626
Vulnerability Analysis
The vulnerability exists in ksmbd_vfs_stream_write, a function in the kernel SMB server (ksmbd) that handles writes to alternate data streams backed by extended attributes. When a client sends a write request, it supplies an offset indicating where in the stream data should be placed. The function did not validate that this offset is a non-negative value before using it as an index into the allocated buffer.
A crafted SMB write request specifying a negative offset causes the kernel to compute a destination pointer below the start of the allocated buffer. The subsequent memcpy writes attacker-controlled data into adjacent kernel memory, corrupting unrelated kernel objects.
Root Cause
The root cause is missing input validation on a signed offset value received from an untrusted SMB client. The offset is treated as a valid index without bounds checks against zero or the buffer length. This is a classic out-of-bounds write [CWE-787] caused by improper handling of signed integers in a length and offset calculation.
Attack Vector
Exploitation requires local network access to a Linux host running ksmbd with vfs objects = streams_xattr configured, plus valid SMB credentials for a share. An authenticated attacker submits an SMB write request to an alternate data stream with a negative offset field. The resulting kernel heap corruption can be shaped into privilege escalation or kernel denial of service. See the Debian LTS Announcement and the upstream fix commits referenced below for technical details of the patch.
Detection Methods for CVE-2024-56626
Indicators of Compromise
- Unexpected ksmbd kernel oops, panic, or BUG: KASAN: slab-out-of-bounds messages in dmesg or /var/log/kern.log
- SMB connections from unexpected local clients to hosts running ksmbd with streams_xattr enabled
- Anomalous SMB write requests targeting alternate data streams with malformed offset fields
Detection Strategies
- Audit ksmbd.conf across the fleet for the presence of vfs objects = streams_xattr and inventory exposed shares
- Enable kernel address sanitization (KASAN) on test systems to catch out-of-bounds writes in ksmbd_vfs_stream_write
- Monitor for unexpected ksmbd worker thread crashes or kernel taint flags appearing after SMB activity
Monitoring Recommendations
- Forward kernel logs to a central SIEM and alert on ksmbd faults, oops, or KASAN reports
- Track SMB authentication failures and successful logons against ksmbd shares to identify reconnaissance preceding exploitation
- Baseline normal SMB write patterns and alert on abnormal write offsets or sizes against stream-enabled shares
How to Mitigate CVE-2024-56626
Immediate Actions Required
- Update the Linux kernel to a patched stable release that includes commits 164d3597d26d, 1aea5c9470be, 313dab082289, 8cd7490fc0f2, or c5797f195c67
- On Debian systems, apply the kernel update from the Debian LTS Announcement
- Restrict access to ksmbd shares to trusted users only and enforce strong SMB authentication
- Disable ksmbd if it is not required for production workloads
Patch Information
The upstream fix validates the client-supplied offset and rejects negative values before performing the write. Patches are available in the stable kernel tree via the following commits: 164d3597d26d, 1aea5c9470be, 313dab082289, 8cd7490fc0f2, and c5797f195c67.
Workarounds
- Remove vfs objects = streams_xattr from ksmbd.conf to eliminate the vulnerable code path until patching is possible
- Stop and disable the ksmbd kernel module on hosts that do not need to serve SMB
- Block inbound SMB (TCP/445) from untrusted networks at the host firewall to reduce the attacker population
# Remove the vulnerable configuration option and restart ksmbd
sudo sed -i '/vfs objects\s*=\s*streams_xattr/d' /etc/ksmbd/ksmbd.conf
sudo systemctl restart ksmbd
# Or unload the module entirely if ksmbd is not required
sudo systemctl stop ksmbd
sudo modprobe -r ksmbd
echo 'blacklist ksmbd' | sudo tee /etc/modprobe.d/disable-ksmbd.conf
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

