🇰🇷 한글 설명
Linux 커널의 usbio 드라이버에서 USB bulk IN 응답 길이를 검증하는 과정에 오류가 있어 발생한 취약점입니다. 악의적인 장치가 실제 할당된 수신 버퍼 크기보다 큰 데이터 길이를 보고할 경우, 메모리 경계를 넘어 데이터를 읽는 slab-out-of-bounds read가 발생하여 인접한 슬랩 메모리가 노출될 수 있습니다.
💡 쉬운 설명
USB 장치가 실제 가진 용량보다 더 많은 데이터를 보내겠다고 속여서 컴퓨터의 비밀스러운 메모리 정보를 몰래 읽어가는 취약점입니다. 이를 통해 시스템 내부의 중요한 정보가 유출될 위험이 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
usb: misc: usbio: bound bulk IN response length to the received transfer
usbio_bulk_msg() copies bpkt_len = le16_to_cpu(bpkt->len) bytes out of
the bulk IN buffer (usbio->rxbuf, allocated with size usbio->rxbuf_len)
into the caller's buffer. bpkt_len is fully controlled by the device
and is only checked against ibuf_len; ibuf_len in turn is checked
against usbio->txbuf_len, not against rxbuf_len:
if ((obuf_len > (usbio->txbuf_len - sizeof(*bpkt))) ||
(ibuf_len > (usbio->txbuf_len - sizeof(*bpkt))))
return -EMSGSIZE;
txbuf_len and rxbuf_len are taken independently from the bulk OUT and
bulk IN endpoint wMaxPacketSize in usbio_probe(). A malicious or
malfunctioning device that advertises a large bulk OUT endpoint and a
small bulk IN endpoint (e.g. by claiming one of the quirk-free IDs such
as the Lattice NX33U, 0x2ac1:0x20cb) therefore makes ibuf_len, and
hence the device-supplied bpkt_len, exceed rxbuf_len. memcpy() then
reads up to txbuf_len - rxbuf_len bytes past the end of the rxbuf slab
object. The over-read bytes are handed back to the i2c layer and on to
user space through i2c-dev, disclosing adjacent slab memory; with KASAN
this is reported as a slab-out-of-bounds read.
The number of bytes actually received is already known: act equals the
URB actual_length and is bounded by rxbuf_len. Reject any response
that claims more payload than was received, mirroring the existing
"act < sizeof(*bpkt)" check just above.
The control path (usbio_ctrl_msg()) is not affected: it uses a single
buffer (ctrlbuf) for both directions, so its analogous copy can never
leave the allocation.
Found by code review. The out-of-bounds read was confirmed under
AddressSanitizer with a faithful userspace model of usbio_bulk_msg()'s
receive path (an rxbuf_len-sized buffer, the same act/ibuf_len/bpkt_len
checks and the memcpy). A USB raw-gadget + dummy_hcd reproducer is
also available.
📍 영향받는 시스템
Linux kernel (usb: misc: usbio driver 포함 버전)
⚔️ 공격 벡터
조작된 엔드포인트 크기를 광고하는 악의적인 USB 장치를 연결하여 메모리 오버리드 유도
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 usbio_bulk_msg()의 길이 검증 로직 수정
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이후인지 확인하십시오.