🇰🇷 한글 설명
Linux 커널의 USB 시리얼 드라이버(kl5kusb105)에서 버퍼 오버플로우 취약점이 발견되었습니다. 데이터 쓰기 과정에서 헤더 크기를 고려하지 않고 전체 버퍼 크기만큼 데이터를 복사하여, 할당된 메모리 범위를 벗어나는 슬랩(slab) 영역 외부 쓰기가 발생할 수 있습니다.
💡 쉬운 설명
USB 장치에 데이터를 보낼 때, 데이터를 담는 그릇의 크기를 잘못 계산하여 정해진 범위를 넘어서는 데이터를 써버리는 문제입니다. 이로 인해 컴퓨터의 중요한 메모리 영역이 망가질 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
USB: serial: kl5kusb105: fix bulk-out buffer overflow
klsi_105_prepare_write_buffer() is called by the generic write path
with the bulk-out buffer and its size (bulk_out_size, 64 bytes). It
stores a two-byte length header at the start of the buffer and copies
the payload from the write fifo starting at buf + KLSI_HDR_LEN, but
passes the full buffer size as the number of bytes to copy:
count = kfifo_out_locked(&port->write_fifo, buf + KLSI_HDR_LEN,
size, &port->lock);
When the fifo holds at least size bytes, size bytes are copied starting
two bytes into the size-byte buffer, writing KLSI_HDR_LEN bytes past its
end. Copy at most size - KLSI_HDR_LEN bytes instead, leaving room for
the header as safe_serial already does.
Writing bulk_out_size or more bytes to the tty triggers a slab
out-of-bounds write, observed with KASAN by emulating the device with
dummy_hcd and raw-gadget:
BUG: KASAN: slab-out-of-bounds in kfifo_copy_out+0x83/0xc0
Write of size 64 at addr ffff888112c62202 by task python3
kfifo_copy_out
klsi_105_prepare_write_buffer [kl5kusb105]
usb_serial_generic_write_start [usbserial]
Allocated by task 139:
usb_serial_probe [usbserial]
The buggy address is located 2 bytes inside of allocated 64-byte region
The out-of-bounds write no longer occurs with this change applied.
📍 영향받는 시스템
Linux Kernel (kl5kusb105 USB serial driver 포함 버전)
⚔️ 공격 벡터
취약한 USB 장치에 특정 크기 이상의 데이터를 전송하여 메모리 오버플로우 유도
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이후인지 확인