Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2024-22705 Overview
CVE-2024-22705 is an out-of-bounds read vulnerability in the ksmbd component of the Linux kernel before version 6.6.10. The flaw resides in smb2_get_data_area_len within fs/smb/server/smb2misc.c. The function mishandles the relationship between Name data and CreateContexts data, triggering an out-of-bounds access in smb_strndup_from_utf16. An authenticated local attacker can exploit this condition to compromise confidentiality, integrity, and availability of the affected system. The vulnerability is tracked under CWE-125 and affects Linux kernel versions prior to 6.6.10, including the 6.7 release candidates (rc1 through rc7).
Critical Impact
Local attackers with low privileges can trigger an out-of-bounds read in the kernel SMB server, potentially leading to information disclosure, kernel memory corruption, or denial of service.
Affected Products
- Linux kernel versions before 6.6.10
- Linux kernel 6.7-rc1 through 6.7-rc7
- Distributions shipping ksmbd built from affected kernel sources
Discovery Timeline
- 2024-01-23 - CVE-2024-22705 published to NVD
- 2026-06-17 - Last updated in NVD database
Technical Details for CVE-2024-22705
Vulnerability Analysis
The ksmbd subsystem implements an in-kernel SMB3 server for Linux. When parsing SMB2 CREATE requests, smb2_get_data_area_len in fs/smb/server/smb2misc.c computes the length of the data region containing the file Name and CreateContexts fields. The function fails to correctly validate the layout relationship between these two fields.
When the parsed length is used by smb_strndup_from_utf16 to duplicate the UTF-16 Name string, the function reads memory past the intended buffer boundary. This out-of-bounds read can expose adjacent kernel memory contents or crash the kernel if the read crosses a page boundary into unmapped memory.
Root Cause
The root cause is improper boundary validation in smb2_get_data_area_len. The function treats the Name and CreateContexts regions independently without enforcing that the Name length stays within the request payload bounds. This parser-level flaw [CWE-125] allows crafted SMB2 CREATE requests to drive subsequent string handling routines past the end of allocated buffers.
Attack Vector
Exploitation requires local access with authenticated low-privilege credentials to an SMB share served by ksmbd. An attacker constructs a malformed SMB2 CREATE request where the Name field length is inconsistent with the CreateContexts offset. When the kernel processes the request, smb_strndup_from_utf16 reads beyond the request buffer, returning kernel memory data or triggering a fault.
The fix was committed upstream in commit d10c77873ba1e9e6b91905018e29e196fd5f863d and shipped in the Linux Kernel 6.6.10 ChangeLog. Refer to the upstream commit for the precise bounds-checking logic added to the parser.
Detection Methods for CVE-2024-22705
Indicators of Compromise
- Kernel oops or panic messages referencing smb2_get_data_area_len, smb_strndup_from_utf16, or ksmbd in dmesg output
- Unexpected ksmbd.mountd or ksmbd worker thread crashes recorded in system journals
- Anomalous SMB2 CREATE requests with inconsistent Name and CreateContexts length fields captured in network traffic
Detection Strategies
- Audit running kernel versions across Linux fleet and flag hosts running kernels earlier than 6.6.10 with ksmbd loaded
- Monitor kernel ring buffer logs for KASAN or slab-out-of-bounds reports tied to the ksmbd module
- Inspect SMB traffic to ksmbd endpoints for malformed CREATE context structures using packet capture tools or Zeek SMB analyzers
Monitoring Recommendations
- Centralize kernel logs and alert on crashes within fs/smb/server/ code paths
- Track ksmbd service restarts and process termination events as potential exploitation signals
- Enable auditd rules for module_load events to detect ksmbd being loaded on hosts where it is not expected
How to Mitigate CVE-2024-22705
Immediate Actions Required
- Upgrade affected systems to Linux kernel 6.6.10 or later, or apply vendor backports containing commit d10c77873ba
- Unload the ksmbd kernel module on hosts that do not require an SMB server using modprobe -r ksmbd
- Restrict SMB access to trusted network segments using firewall rules on TCP port 445
- Revoke or rotate credentials used to authenticate to ksmbd shares if compromise is suspected
Patch Information
The fix is included in Linux kernel 6.6.10. Review the Linux Kernel ChangeLog 6.6.10 and the upstream fix in commit d10c77873ba. Enterprise distributions (Red Hat, SUSE, Ubuntu, Debian) should be updated using vendor-provided kernel packages that incorporate this backport.
Workarounds
- Disable the ksmbd module and migrate to userspace Samba (smbd) where kernel upgrade is not immediately feasible
- Blacklist the ksmbd module in /etc/modprobe.d/ to prevent automatic loading
- Limit SMB share access to authenticated, trusted users only, and enforce network segmentation to reduce the local attack surface
# Verify kernel version and ksmbd module status
uname -r
lsmod | grep ksmbd
# Unload and blacklist the ksmbd module as a temporary workaround
sudo modprobe -r ksmbd
echo "blacklist ksmbd" | sudo tee /etc/modprobe.d/blacklist-ksmbd.conf
# Restrict SMB traffic to trusted sources (example using nftables)
sudo nft add rule inet filter input tcp dport 445 ip saddr != 10.0.0.0/24 drop
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

