製品・ソフトウェアに関する情報
LinuxのLinux Kernelにおける境界外書き込みに関する脆弱性
Title LinuxのLinux Kernelにおける境界外書き込みに関する脆弱性
Summary

Linuxカーネルにおいて、以下の脆弱性が修正されました。ksmbdのipc_validate_msg()関数内でレスポンスサイズの検証を行います。ipc_validate_msg()は、攻撃者が制御可能なデーモンレスポンスのフィールドを固定構造体サイズに加算または乗算し、各レスポンスタイプの予想メッセージサイズを符号なし整数の算術で計算します。次の3つの場合にオーバーフローが発生する可能性があります。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は__u32型、resp-ngroupsは__s32型です。各加算は符号なし整数でラップする可能性があり、sizeof(gid_t)との乗算は符号付きとsize_tの混用であるため、負のngroupsは乗算前にSIZE_MAXに変換されます。ラップしたmsg_szの値がたまたまentry-msg_szと等しい場合、次の行でのサイズチェックを回避し、下流の消費者(smb2pdu.c:6742のrpc_resp-payload_szを使うmemcpyやksmbd_alloc_userのkmemdupでresp_ext-ngroupsを使用)が未検証の長さを信用してしまいます。RPC_REQUESTおよびSHARE_CONFIG_REQUESTのパスにはcheck_add_overflow()を使用し、整数オーバーフローを検出しつつ機能的なペイロードサイズを制限しません。ユーザー空間のksmbd-toolsはNetShareEnumAllのような呼び出しでNDRレスポンスを4096バイト単位で増加させるため、レスポンス側でのハードな転送上限は不適切です。LOGIN_REQUEST_EXTについては、resp-ngroupsが符号付きの[0, NGROUPS_MAX]範囲外であれば受付けず、ipc_validate_msg()でエラーを報告してIPC境界で検出できるようにしています。この制限により乗算・加算はUINT_MAXを大幅に下回ります。今後は冗長となるngroupsチェックとksmbd_alloc_user()内のpr_errを削除します。これはリクエスト側を強化したaab98e2dbd64("ksmbd: 32ビットシステムでの整数オーバーフロー修正")のレスポンス側に対応した修正です。

Possible impacts 当該ソフトウェアが扱う全ての情報が外部に漏れる可能性があります。 また、当該ソフトウェアが扱う情報について、書き換えは発生しません。 さらに、当該ソフトウェアが完全に停止する可能性があります。 そして、この脆弱性を悪用した攻撃の影響は、他のソフトウェアには及びません。 
Solution

リリース情報、またはパッチ情報が公開されています。参考情報を参照して適切な対策を実施してください。

Publication Date May 1, 2026, midnight
Registration Date May 8, 2026, 12:06 p.m.
Last Update May 8, 2026, 12:06 p.m.
CVSS3.0 : 重要
Score 7.1
Vector CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:H
Affected System
Linux
Linux Kernel 5.15 以上 6.12.84 未満
Linux Kernel 6.13 以上 6.18.25 未満
Linux Kernel 6.19 以上 7.0.2 未満
CVE (情報セキュリティ 共通脆弱性識別子)
CWE (共通脆弱性タイプ一覧)
その他
Change Log
No Changed Details Date of change
1 [2026年05月08日]
  掲載
May 8, 2026, 12:06 p.m.

NVD Vulnerability Information
CVE-2026-31707
Summary

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.

Publication Date May 1, 2026, 11:16 p.m.
Registration Date May 2, 2026, 4:06 a.m.
Last Update May 7, 2026, 5:26 a.m.
Affected software configurations
Configuration1 or higher or less more than less than
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 5.15 6.12.84
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 6.13 6.18.25
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 6.19 7.0.2
Related information, measures and tools
Common Vulnerabilities List