diff options
| author | Abdifatah Suruur <suruurism@gmail.com> | 2026-10-22 06:53:29 +0300 |
|---|---|---|
| committer | Paulo Alcantara <pc@manguebit.org> | 2026-10-23 12:26:03 -0300 |
| commit | 2ec9cdf469dd32bcf33073aeb30c08e9356e0ca1 (patch) | |
| tree | d2f0e38e4a7971d15a9a057557ca1a6cd231d7b7 /scripts/basic | |
| parent | 4d8930afa3446041358a7db33e7b23a0bb9459b5 (diff) | |
| download | linux-2ec9cdf469dd32bcf33073aeb30c08e9356e0ca1.tar.gz linux-2ec9cdf469dd32bcf33073aeb30c08e9356e0ca1.zip | |
smb: client: validate the data area in SMB2_read()
SMB2_read() copies le32_to_cpu(rsp->DataLength) bytes from
(char *)rsp + rsp->DataOffset without checking that the range lies
within the response actually received. A READ response with
DataOffset == 0 makes smb2_get_data_area_len() zero the data length, so
smb2_check_message() accepts a frame as short as the fixed response,
while SMB2_read() still uses the server-supplied DataLength, capped only
by CIFS_MAX_MSGSIZE and the caller's length.
A malicious server can answer the synchronous read used by the
mfsymlinks (or SFU) symlink parser with an 81-byte READ response
carrying DataOffset 0 and DataLength 1067, making the client copy 1067
bytes from a 448-byte receive object (KASAN slab-out-of-bounds; up to
16 KiB in the general case).
Clamp a zero (or header-overlapping) DataOffset to read_rsp_size, as
handle_read_data() does for the asynchronous path, and reject the
response unless DataOffset + DataLength fits within rsp_iov.iov_len.
The SMB1 helper was fixed the same way in 5be5bdda5863.
Fixes: d8e050398d23 ("CIFS: Add readpage support for SMB2")
Cc: stable@vger.kernel.org
Signed-off-by: Abdifatah Suruur <suruurism@gmail.com>
Reviewed-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Diffstat (limited to 'scripts/basic')
0 files changed, 0 insertions, 0 deletions
