🔍 CVE-2026-31707

7.1
CVSS Score
HIGH
2026-05-01
2026-05-06 20:26
✅ 완료

🇰🇷 한글 설명

Linux 커널 ksmbd에서 ipc_validate_msg() 함수가 공격자 제어 필드를 고정 구조체 크기에 더할 때 부호 없는 정수 오버플로우를 일으킬 수 있다. 이는 메모리 크기 검증을 우회하여 버퍼 오버플로우 및 메모리 침범 취약점을 발생시킨다. 패치는 오버플로우 감지 및 범위 검증을 추가하여 해결한다.

💡 쉬운 설명

Linux 커널의 파일 공유 기능(ksmbd)이 메시지 크기를 잘못 계산할 수 있다. 공격자가 이를 악용하여 메모리를 초과 접근하고 시스템을 손상시킬 수 있다.

🇺🇸 원문 (English)

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.

📍 영향받는 시스템

Linux kernel ksmbd (5.15 이상 모든 버전, 패치 적용 전)

⚔️ 공격 벡터

악의적인 ksmbd 데몬 응답으로 정수 오버플로우 트리거하여 크기 검증 우회 후 메모리 침범

🛡️ 대응 방법

Linux 커널을 최신 패치 버전으로 업그레이드 또는 ksmbd 보안 패치 적용

🔧 검증 코드

출력된 커널 버전이 패치 적용된 최신 안정 버전보다 낮으면 취약한 상태

Shell / Script
cat /proc/version | grep -oP '\d+\.\d+\.\d+' | head -1

📊 CVSS Vector String

CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:H

💻 영향받는 소프트웨어

Linux Kernel