🇰🇷 한글 설명
리눅스 커널의 vt 서브시스템에서 보이지 않는 가상 콘솔의 폰트 크기를 변경할 때 프레임버퍼 버퍼 크기가 적절히 조정되지 않아 발생하는 취약점입니다. 특정 제어 시퀀스(ESC # 8)를 사용할 때 화면 업데이트 여부를 확인하는 검사 과정이 누락되어 슬랩 영역 밖의 메모리에 접근하는 Out-of-bounds 오류가 발생합니다.
💡 쉬운 설명
컴퓨터 화면에 글자를 보여주는 기능에서, 화면에 보이지 않는 글자 크기를 바꿨을 때 메모리 공간을 제대로 준비하지 않아 발생하는 오류입니다. 이로 인해 시스템이 예기치 않게 멈추거나 메모리 오류가 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
vt: skip screen update for DEC alignment test on backgroup consoles
[BUG]
Recently, we encountered a KASAN warning as follows:
BUG: KASAN: slab-out-of-bounds in fb_pad_aligned_buffer+0x11f/0x140
Read of size 1 at addr ff1100015fd9f6a4 by task tty_fbcon_oob/1239
CPU: 7 UID: 0 PID: 1239 Comm: tty_fbcon_oob Not tainted 7.3.0-rc1 #100 PREEMPT(full)
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.17.0-4.fc41 04/01/2014
Call Trace:
<TASK>
...
kasan_report+0xf0/0x120
fb_pad_aligned_buffer+0x11f/0x140
ccw_putcs+0x86c/0xa80
fbcon_putcs+0x338/0x410
do_update_region+0x21d/0x450
do_con_write+0x1e0e/0x4880
con_write+0x13/0x80
n_tty_write+0x374/0x1010
file_tty_write.isra.0+0x404/0x7a0
...
reproduce:
1) open /dev/tty0, set a KDFONTOP ioctl with op.op = KD_FONT_OP_SET,
op.width = 8 and op.height = 16 (visible VC1)
2) open /dev/tty1, set a KDFONTOP ioctl with op.op = KD_FONT_OP_SET,
op.width = 28 and op.height = 24 (invisible VC2)
3) echo 3 > /sys/devices/virtual/graphics/fbcon/rotate_all
4) write EShash8(esc hash8) to tty1
[CAUSE]
All VCs render to the framebuffer. setfont only modifies the target VC's
font without resizing the framebuffer backing buffer (par->rotated.buf);
the buffer is only resized for the visible VC
(fbcon_do_set_font -> ... -> vc_do_resize -> update_screen). This relies on
the con_should_update() check performed before every update_region().
However, the ESC # 8 path (do_con_trol -> do_update_region) omits the
con_should_update() check. After changing the font size of an invisible VC,
do_update_region() fills using the new font size against a buffer that was
never resized, causing an out-of-bounds access.
[FIX]
Only push the update when the console is visible and not blanked, add
the con_should_update() check in the do_con_trol() like every other call
site of do_update_region() (update_region(), invert_screen(), ...).
📍 영향받는 시스템
Linux kernel (7.3.0-rc1 및 관련 버전)
⚔️ 공격 벡터
보이지 않는 가상 콘솔(VC)의 폰트 크기를 변경한 후, 특정 제어 시퀀스(ESC # 8)를 전송하여 메모리 경계 외 접근 유도
🛡️ 대응 방법
리눅스 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 do_con_trol() 내의 화면 업데이트 검사 로직을 적용해야 합니다.
🔧 검증 코드
출력된 커널 버전이 취약점이 해결된 패치 버전 이후인지 확인합니다.