CVE-2026-31707

In the Linux kernel, the following vulnerability has been resolved: ksmbd: validate response sizes in ipc_validate_msg() ipc_validate_msg() computes the expected message size for each response type by adding (or multiplying) attacker-controlled fields from the daemon response to a fixed struct size in unsigned int arithmetic. Three cases can overflow: KSMBD_EVENT_RPC_REQUEST: msg_sz = sizeof(struct ksmbd_rpc_command) + resp->payload_sz; KSMBD_EVENT_SHARE_CONFIG_REQUEST: msg_sz = sizeof(struct ksmbd_share_config_response) + resp->payload_sz; KSMBD_EVENT_LOGIN_REQUEST_EXT: msg_sz = sizeof(struct ksmbd_login_response_ext) + resp->ngroups * sizeof(gid_t); resp->payload_sz is __u32 and resp->ngroups is __s32. Each addition can wrap in unsigned int; the multiplication by sizeof(gid_t) mixes signed and size_t, so a negative ngroups is converted to SIZE_MAX before the multiply. A wrapped value of msg_sz that happens to equal entry->msg_sz bypasses the size check on the next line, and downstream consumers (smb2pdu.c:6742 memcpy using rpc_resp->payload_sz, kmemdup in ksmbd_alloc_user using resp_ext->ngroups) then trust the unverified length. Use check_add_overflow() on the RPC_REQUEST and SHARE_CONFIG_REQUEST paths to detect integer overflow without constraining functional payload size; userspace ksmbd-tools grows NDR responses in 4096-byte chunks for calls like NetShareEnumAll, so a hard transport cap is unworkable on the response side. For LOGIN_REQUEST_EXT, reject resp->ngroups outside the signed [0, NGROUPS_MAX] range up front and report the error from ipc_validate_msg() so it fires at the IPC boundary; with that bound the subsequent multiplication and addition stay well below UINT_MAX. The now-redundant ngroups check and pr_err in ksmbd_alloc_user() are removed. This is the response-side analogue of aab98e2dbd64 ("ksmbd: fix integer overflows on 32 bit systems"), which hardened the request side.
Configurations

Configuration 1 (hide)

OR cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*

History

11 Nov 2026, 21:10

Type Values Removed Values Added
Summary
  • (es) En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta: ksmbd: validar tamaños de respuesta en ipc_validate_msg() ipc_validate_msg() calcula el tamaño de mensaje esperado para cada tipo de respuesta sumando (o multiplicando) campos controlados por el atacante de la respuesta del demonio a un tamaño de estructura fijo en aritmética de entero sin signo. Tres casos pueden desbordarse: KSMBD_EVENT_RPC_REQUEST: msg_sz = sizeof(struct ksmbd_rpc_command) + resp -> payload_sz; KSMBD_EVENT_SHARE_CONFIG_REQUEST: msg_sz = sizeof(struct ksmbd_share_config_response) + resp -> payload_sz; KSMBD_EVENT_LOGIN_REQUEST_EXT: msg_sz = sizeof(struct ksmbd_login_response_ext) + resp -> ngroups * sizeof(gid_t); resp -> payload_sz es __u32 y resp -> ngroups es __s32. Cada suma puede envolverse en entero sin signo; la multiplicación por sizeof(gid_t) mezcla con signo y size_t, por lo que un ngroups negativo se convierte a SIZE_MAX antes de la multiplicación. Un valor envuelto de msg_sz que resulta ser igual a entry -> msg_sz omite la comprobación de tamaño en la siguiente línea, y los consumidores posteriores (smb2pdu.c:6742 memcpy usando rpc_resp -> payload_sz, kmemdup en ksmbd_alloc_user usando resp_ext -> ngroups) entonces confían en la longitud no verificada. Usar check_add_overflow() en las rutas RPC_REQUEST y SHARE_CONFIG_REQUEST para detectar desbordamiento de entero sin restringir el tamaño de carga útil funcional; las herramientas ksmbd del espacio de usuario aumentan las respuestas NDR en bloques de 4096 bytes para llamadas como NetShareEnumAll, por lo que un límite de transporte estricto es inviable en el lado de la respuesta. Para LOGIN_REQUEST_EXT, rechazar resp -> ngroups fuera del rango con signo [0, NGROUPS_MAX] de antemano y reportar el error desde ipc_validate_msg() para que se active en el límite IPC; con ese límite la multiplicación y suma subsiguientes se mantienen muy por debajo de UINT_MAX. La comprobación de ngroups ahora redundante y pr_err en ksmbd_alloc_user() se eliminan. Este es el análogo del lado de la respuesta de aab98e2dbd64 (’ksmbd: corregir desbordamientos de entero en sistemas de 32 bits’), que reforzó el lado de la solicitud.

30 Oct 2026, 13:18

Type Values Removed Values Added
References
  • () https://git.kernel.org/stable/c/52518503a1a00bc33e9522c4eb05df023e3ae978 -

Information

Published : 2026-05-01 14:16

Updated : 2026-11-11 21:10


NVD link : CVE-2026-31707

Mitre link : CVE-2026-31707

CVE.ORG link : CVE-2026-31707


JSON object : View

Products Affected

linux

  • linux_kernel
CWE
CWE-787

Out-of-bounds Write