🇰🇷 한글 설명
리눅스 커널의 fbcon 구성 요소에서 프레임버퍼 해제 시 fb_display 배열 내의 모드 포인터를 NULL로 설정하지 않아 발생하는 Use-After-Free(UAF) 취약점입니다. 프레임버퍼 등록 해제 과정에서 메모리는 해제되지만 포인터가 남아 있어, 이후 해당 메모리에 접근할 때 시스템 오류나 보안 문제가 발생할 수 있습니다.
💡 쉬운 설명
컴퓨터 화면을 관리하는 프로그램이 사용이 끝난 메모리 주소를 지우지 않고 계속 붙잡고 있어 발생하는 문제입니다. 이로 인해 이미 사라진 데이터를 다시 읽으려다 시스템이 멈추거나 해킹의 통로가 될 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
fbcon: Set fb_display[i]->mode to NULL when the mode is released
Recently, we discovered the following issue through syzkaller:
BUG: KASAN: slab-use-after-free in fb_mode_is_equal+0x285/0x2f0
Read of size 4 at addr ff11000001b3c69c by task syz.xxx
...
Call Trace:
<TASK>
dump_stack_lvl+0xab/0xe0
print_address_description.constprop.0+0x2c/0x390
print_report+0xb9/0x280
kasan_report+0xb8/0xf0
fb_mode_is_equal+0x285/0x2f0
fbcon_mode_deleted+0x129/0x180
fb_set_var+0xe7f/0x11d0
do_fb_ioctl+0x6a0/0x750
fb_ioctl+0xe0/0x140
__x64_sys_ioctl+0x193/0x210
do_syscall_64+0x5f/0x9c0
entry_SYSCALL_64_after_hwframe+0x76/0x7e
Based on experimentation and analysis, during framebuffer unregistration,
only the memory of fb_info->modelist is freed, without setting the
corresponding fb_display[i]->mode to NULL for the freed modes. This leads
to UAF issues during subsequent accesses. Here's an example of reproduction
steps:
1. With /dev/fb0 already registered in the system, load a kernel module
to register a new device /dev/fb1;
2. Set fb1's mode to the global fb_display[] array (via FBIOPUT_CON2FBMAP);
3. Switch console from fb to VGA (to allow normal rmmod of the ko);
4. Unload the kernel module, at this point fb1's modelist is freed, leaving
a wild pointer in fb_display[];
5. Trigger the bug via system calls through fb0 attempting to delete a mode
from fb0.
Add a check in do_unregister_framebuffer(): if the mode to be freed exists
in fb_display[], set the corresponding mode pointer to NULL.
📍 영향받는 시스템
Linux Kernel (fbcon 관련 모듈 사용 시스템)
⚔️ 공격 벡터
특정 순서로 프레임버퍼를 등록, 매핑, 해제한 후 시스템 호출(ioctl)을 통해 잘못된 메모리 주소에 접근
🛡️ 대응 방법
do_unregister_framebuffer() 함수에 fb_display[] 내의 모드 포인터를 NULL로 설정하는 패치를 적용한 최신 커널로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 패치된 최신 보안 업데이트 버전인지 확인