🇰🇷 한글 설명
Linux 커널의 fbdev vfb 드라이버에서 발생하는 Use-After-Free 취약점입니다. FBIOGETCMAP ioctl 호출 시 락을 해제한 후 사용자 공간으로 데이터를 복사하는 과정에서, 동시에 드라이버가 언바인딩되면 컬러맵 메모리가 먼저 해제되어 메모리 오류가 발생할 수 있습니다.
💡 쉬운 설명
컴퓨터 화면의 색상 정보를 읽어오는 도중에 해당 정보가 저장된 메모리가 갑자기 삭제되어 발생하는 오류입니다. 이로 인해 시스템이 충돌하거나 보안 문제가 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
fbdev: vfb: defer cleanup until the last reference
FBIOGETCMAP takes a shallow snapshot of info->cmap and performs the
usercopy after dropping info->lock. vfb_remove() frees the colormap
immediately after unregistering the framebuffer, even when an open file
still holds a reference to fb_info. A concurrent driver unbind can
therefore free the colormap while the ioctl copies it to userspace.
KASAN reports:
BUG: KASAN: slab-use-after-free in _copy_to_user
Read of size 512 by task poc/125
_copy_to_user (./include/linux/instrumented.h:129 ./include/linux/uaccess.h:201 lib/usercopy.c:24)
fb_cmap_to_user (./include/linux/uaccess.h:230 drivers/video/fbdev/core/fbcmap.c:211)
do_fb_ioctl (drivers/video/fbdev/core/fb_chrdev.c:114)
Allocated by task 1:
fb_alloc_cmap_gfp (./include/linux/slab.h:973 ./include/linux/slab.h:1290 drivers/video/fbdev/core/fbcmap.c:108)
vfb_probe (drivers/video/fbdev/vfb.c:459)
Freed by task 124:
fb_dealloc_cmap (drivers/video/fbdev/core/fbcmap.c:151)
vfb_remove (drivers/video/fbdev/vfb.c:489)
unregister_framebuffer() drops the registration reference, and fbdev calls
fb_destroy after the last put_fb_info(). Move the registered framebuffer's
cleanup into an fb_destroy callback so its colormap and screen buffer stay
alive until all file references have been released.
📍 영향받는 시스템
Linux kernel (vfb driver 사용 환경)
⚔️ 공격 벡터
동시성 제어 미흡을 이용한 Race Condition 공격 (드라이버 언바인딩과 ioctl 호출의 병행)
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 fb_destroy 콜백을 통해 메모리 해제 시점을 조정해야 합니다.
🔧 검증 코드
출력된 커널 버전을 확인하여 해당 취약점이 수정된 패치 버전인지 확인합니다.