🇰🇷 한글 설명
Linux 커널의 device-mapper ioctl 처리 코드에서 get_result_buffer()가 실제 버퍼 크기를 확인하지 않고 data_start를 sizeof(struct dm_ioctl)로 설정하여, 최소 크기 버퍼 요청 시 data_start가 버퍼 끝을 7바이트 넘어서는 문제입니다. 이로 인해 ctl_ioctl()이 할당 영역 밖의 메모리를 사용자 공간으로 복사하는 범위 외 읽기(out-of-bounds read)가 발생합니다. 커널은 data_start를 버퍼 크기로 제한하도록 수정되었습니다.
💡 쉬운 설명
리눅스 커널의 디스크 매핑 기능에서 메모리 경계를 넘어 데이터를 읽는 결함이 있습니다. 보안 위험은 낮으며 관리자(root) 권한이 있어야 악용할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
dm ioctl: don't let data_start run past the buffer
struct dm_ioctl has seven bytes of trailing padding, so the smallest
buffer userspace is allowed to ask for, offsetof(struct dm_ioctl, data),
is seven bytes shorter than sizeof(struct dm_ioctl).
get_result_buffer() sets data_start to sizeof(struct dm_ioctl) without
looking at how big the buffer actually is. Ask for the minimum and
data_start ends up seven bytes past the end. Callers add it to
data_size, and ctl_ioctl() copies that much back to userspace:
BUG: KASAN: slab-out-of-bounds in _copy_to_user+0xad/0xd0
Read of size 312 at addr ffff8880169e4c00 by task repro-dm/140
ctl_ioctl+0x5e3/0xcb0
dm_ctl_ioctl+0x25/0x40
allocated 305-byte region [ffff8880169e4c00, ffff8880169e4d31)
A DM_LIST_DEVICES with data_size set to 305 is enough to hit it, and the
seven bytes that leak are whatever sat next to the allocation.
Clamp data_start to the buffer size.
Note that this is not a security bug because the out-of-bounds read can
only be triggered by root.
📍 영향받는 시스템
패치 이전의 Linux 커널 (device-mapper ioctl 코드를 포함한 버전)
⚔️ 공격 벡터
root 권한을 가진 사용자가 DM_LIST_DEVICES ioctl을 특정 data_size로 호출하여 할당 영역 밖의 인접 메모리를 읽어냄 (보안 취약점이 아님)
🛡️ 대응 방법
배포판 제공 최신 커널 업데이트를 적용하고 재부팅
🔧 검증 코드
출력된 커널 버전을 배포판 보안 공지 또는 상위 커널의 수정 커밋 이후 버전과 비교하여, 패치가 포함되었는지 확인합니다.