🇰🇷 한글 설명
Linux 커널의 chaoskey 드라이버에서 usb_interface 구조체를 해제한 후에도 디버깅 로그를 위해 해당 메모리에 접근하려 시도하는 Use-After-Free 취약점이 발견되었습니다. USB 장치가 제거된 후 사용자가 장치 파일을 닫을 때 발생하며, 이로 인해 시스템 불안정이나 커널 패닉이 발생할 수 있습니다.
💡 쉬운 설명
USB 장치를 뽑은 직후에 해당 장치를 사용하던 프로그램을 종료하면, 컴퓨터가 이미 사라진 장치 정보를 읽으려다 오류를 일으키는 문제입니다. 이는 시스템을 갑자기 멈추게 하거나 충돌을 일으킬 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
USB: chaoskey: Fix slab-use-after-free in chaoskey_release()
The chaoskey driver has a use-after-free bug in its release routine.
If the user closes the device file after the USB device has been
unplugged, a debugging log statement will try to access the
usb_interface structure after it has been deallocated:
BUG: KASAN: slab-use-after-free in dev_driver_string (drivers/base/core.c:2406)
Read of size 8 at addr ffff888168e8a0b8 by task chaoskey_raw_re/10106
Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl (lib/dump_stack.c:94 lib/dump_stack.c:120)
print_report (mm/kasan/report.c:378 mm/kasan/report.c:482)
kasan_report (mm/kasan/report.c:595)
dev_driver_string (drivers/base/core.c:2406)
__dynamic_dev_dbg (lib/dynamic_debug.c:906)
chaoskey_release (drivers/usb/misc/chaoskey.c:323)
__fput (fs/file_table.c:510)
fput_close_sync (fs/file_table.c:615)
__x64_sys_close (fs/open.c:1507 fs/open.c:1492 fs/open.c:1492)
do_syscall_64 (arch/x86/entry/syscall_64.c:63 arch/x86/entry/syscall_64.c:94)
entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121)
The driver's last reference to the interface structure is dropped in
the chaoskey_free() routine, so the code must not use the interface --
even in a debugging statement -- after that routine returns.
(Exception: If we know that another reference is held by someone else,
such as the device core while the disconnect routine runs, there's no
problem. Thanks to Johan Hovold for pointing this out.)
Since the bad access is part of an unimportant debugging statement,
we can fix the problem simply by removing the whole statement.
📍 영향받는 시스템
chaoskey 드라이버가 포함된 Linux 커널 버전
⚔️ 공격 벡터
USB 장치를 물리적으로 제거한 후 관련 장치 파일을 닫는 특정 동작을 통해 유도 가능
🛡️ 대응 방법
해당 취약점이 수정된 최신 Linux 커널로 업데이트하거나, 문제가 되는 디버깅 로그 코드가 제거된 패치를 적용해야 합니다.
🔧 검증 코드
출력된 커널 버전이 취약점이 해결된 패치 버전 이후인지 확인합니다.