CVE-2026-31707
Severity CVSS v4.0:
Pending analysis
Type:
CWE-787
Out-of-bounds Write
Publication date:
01/05/2026
Last modified:
06/05/2026
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
ksmbd: validate response sizes in ipc_validate_msg()<br />
<br />
ipc_validate_msg() computes the expected message size for each<br />
response type by adding (or multiplying) attacker-controlled fields<br />
from the daemon response to a fixed struct size in unsigned int<br />
arithmetic. Three cases can overflow:<br />
<br />
KSMBD_EVENT_RPC_REQUEST:<br />
msg_sz = sizeof(struct ksmbd_rpc_command) + resp->payload_sz;<br />
KSMBD_EVENT_SHARE_CONFIG_REQUEST:<br />
msg_sz = sizeof(struct ksmbd_share_config_response) +<br />
resp->payload_sz;<br />
KSMBD_EVENT_LOGIN_REQUEST_EXT:<br />
msg_sz = sizeof(struct ksmbd_login_response_ext) +<br />
resp->ngroups * sizeof(gid_t);<br />
<br />
resp->payload_sz is __u32 and resp->ngroups is __s32. Each addition<br />
can wrap in unsigned int; the multiplication by sizeof(gid_t) mixes<br />
signed and size_t, so a negative ngroups is converted to SIZE_MAX<br />
before the multiply. A wrapped value of msg_sz that happens to<br />
equal entry->msg_sz bypasses the size check on the next line, and<br />
downstream consumers (smb2pdu.c:6742 memcpy using rpc_resp->payload_sz,<br />
kmemdup in ksmbd_alloc_user using resp_ext->ngroups) then trust the<br />
unverified length.<br />
<br />
Use check_add_overflow() on the RPC_REQUEST and SHARE_CONFIG_REQUEST<br />
paths to detect integer overflow without constraining functional<br />
payload size; userspace ksmbd-tools grows NDR responses in 4096-byte<br />
chunks for calls like NetShareEnumAll, so a hard transport cap is<br />
unworkable on the response side. For LOGIN_REQUEST_EXT, reject<br />
resp->ngroups outside the signed [0, NGROUPS_MAX] range up front and<br />
report the error from ipc_validate_msg() so it fires at the IPC<br />
boundary; with that bound the subsequent multiplication and addition<br />
stay well below UINT_MAX. The now-redundant ngroups check and<br />
pr_err in ksmbd_alloc_user() are removed.<br />
<br />
This is the response-side analogue of aab98e2dbd64 ("ksmbd: fix<br />
integer overflows on 32 bit systems"), which hardened the request<br />
side.
Impact
Base Score 3.x
7.10
Severity 3.x
HIGH
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.15 (including) | 6.12.84 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.13 (including) | 6.18.25 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.19 (including) | 7.0.2 (excluding) |
To consult the complete list of CPE names with products and versions, see this page



