HIGH
ksmbd QueryInfo OOB
CVE-2026-31433
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
KernelScan AI8.0HIGH
01Description
In the Linux kernel, the following vulnerability has been resolved: ksmbd: fix potencial OOB in get_file_all_info() for compound requests When a compound request consists of QUERY_DIRECTORY + QUERY_INFO (FILE_ALL_INFORMATION) and the first command consumes nearly the entire max_trans_size, get_file_all_info() would blindly call smbConvertToUTF16() with PATH_MAX, causing out-of-bounds write beyond the response buffer. In get_file_all_info(), there was a missing validation check for the client-provided OutputBufferLength before copying the filename into FileName field of the smb2_file_all_info structure. If the filename length exceeds the available buffer space, it could lead to potential buffer overflows or memory corruption during smbConvertToUTF16 conversion. This calculating the actual free buffer size using smb2_calc_max_out_buf_len() and returning -EINVAL if the buffer is insufficient and updating smbConvertToUTF16 to use the actual filename length (clamped by PATH_MAX) to ensure a safe copy operation.
02KernelScan AI Analysis
Risk summary
Remote authenticated SMB clients can trigger an out-of-bounds write in the ksmbd server by sending a crafted compound SMB2 request where a preceding command consumes most of the response buffer. This heap overflow can corrupt kernel memory and lead to denial of service (kernel panic) on systems running ksmbd.
Vulnerability analysis
The vulnerability exists in get_file_all_info() when handling compound SMB2 requests (QUERY_DIRECTORY followed by QUERY_INFO with FILE_ALL_INFORMATION). The code failed to validate the remaining response buffer space before calling smbConvertToUTF16() to copy the filename into the FileName field. When the first command in a compound request leaves insufficient space, the conversion writes up to PATH_MAX bytes beyond the allocated response buffer, resulting in a kernel heap overflow. The fix calculates the actual free buffer size with smb2_calc_max_out_buf_len(), rejects the request if space is insufficient, and clamps the conversion length to the real filename length.
03Fix Versions
| Branch | Fixed in | Patch commit |
|---|---|---|
| 5.15 | 5.15.203 | 3a852f9d1c98 |
| 6.1 | 6.1.168 | 4cca3eff2099 |
| 6.12 | 6.12.80 | 7aec5a769d23 |
| 6.18 | 6.18.21 | b0cd9725fe2b |
| 6.19 | 6.19.11 | 9d7032851d6f |
| 6.6 | 6.6.131 | 358cdaa1f7fb |
| mainline | 7.0 | beef2634f81f |