🇰🇷 한글 설명
Linux 커널의 auxdisplay 드라이버에서 zero-length 메시지를 처리할 때 발생하는 Out-of-Bounds(OOB) Read 취약점입니다. count가 0일 때 인덱스 검사 없이 msg[-1]을 참조하여 인접한 슬랩 데이터를 읽거나, 정수 언더플로우를 유발하여 커널 패닉 또는 메모리 오류를 일으킬 수 있습니다.
💡 쉬운 설명
리눅스 시스템의 특정 화면 표시 장치 드라이버에서 아무런 내용이 없는 데이터를 보낼 때, 시스템이 잘못된 메모리 위치를 읽으려고 시도하는 오류입니다. 이로 인해 시스템이 갑자기 멈추거나 보안 문제가 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
auxdisplay: line-display: fix OOB read on zero-length message_store()
linedisp_display() unconditionally reads msg[count - 1] before
checking whether count is zero, so a write of zero bytes to the
message sysfs attribute hits msg[-1]:
write(fd, "", 0);
-> message_store(..., buf, count=0)
-> linedisp_display(linedisp, buf, count=0)
-> msg[count - 1] == '\n' ; OOB read
The kernfs write buffer for that store is a 1-byte allocation
(kernfs_fop_write_iter() does kmalloc(len + 1) with len == 0),
so msg[-1] is a 1-byte read before the slab object. On a
KASAN-enabled kernel this trips an out-of-bounds report and
panics; on stock kernels it silently reads adjacent slab data
and, if that byte happens to be '\n', the following count--
wraps ssize_t 0 to -1 and is then passed to kmemdup_nul().
linedisp_display() is reached from the message_store() sysfs
callback (drivers/auxdisplay/line-display.c message attribute,
mode 0644) and from the in-tree initial-message setup with
count == -1, so the OOB path is only userspace-triggerable via
zero-byte writes; vfs_write() does not short-circuit on
count == 0 and kernfs_fop_write_iter() dispatches the store
callback regardless.
Guard the trailing-newline trim with a count check. The
existing if (!count) block then takes the clear-display path
unchanged.
Affects every auxdisplay driver that registers via
linedisp_register() / linedisp_attach(): ht16k33, max6959,
img-ascii-lcd, seg-led-gpio.
📍 영향받는 시스템
linedisp_register()를 사용하는 모든 auxdisplay 드라이버 (ht16k33, max6959, img-ascii-lcd, seg-led-gpio 등)
⚔️ 공격 벡터
사용자 공간(userspace)에서 sysfs의 message 속성에 0바이트 데이터를 쓰는 방식으로 트리거 가능
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 linedisp_display() 함수의 count 체크 로직을 적용해야 함
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이후인지 확인하십시오.