🇰🇷 한글 설명
리눅스 커널의 UBI(Unsorted Block Images) 서브시스템에서 볼륨 크기 조정 실패 시 발생하는 Use-After-Free 취약점입니다. ubi_resize_volume 함수에서 오류 발생 시 새로운 테이블을 해제하지만, 해당 테이블이 이미 볼륨 구조체에 참조되고 있어 이후 재시도 시 잘못된 메모리 접근을 유발합니다.
💡 쉬운 설명
컴퓨터의 저장 공간 크기를 조절하다가 오류가 났을 때, 이미 사용 중인 메모리 정보를 잘못 삭제하여 발생하는 문제입니다. 이로 인해 시스템이 갑자기 멈추거나 보안 문제가 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
ubi: Fix use-after-free when volume resizing failed
There is an use-after-free problem reported by KASAN:
==================================================================
BUG: KASAN: use-after-free in ubi_eba_copy_table+0x11f/0x1c0 [ubi]
Read of size 8 at addr ffff888101eec008 by task ubirsvol/4735
CPU: 2 PID: 4735 Comm: ubirsvol
Not tainted 6.1.0-rc1-00003-g84fa3304a7fc-dirty #14
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),
BIOS 1.14.0-1.fc33 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0x34/0x44
print_report+0x171/0x472
kasan_report+0xad/0x130
ubi_eba_copy_table+0x11f/0x1c0 [ubi]
ubi_resize_volume+0x4f9/0xbc0 [ubi]
ubi_cdev_ioctl+0x701/0x1850 [ubi]
__x64_sys_ioctl+0x11d/0x170
do_syscall_64+0x35/0x80
entry_SYSCALL_64_after_hwframe+0x46/0xb0
</TASK>
When ubi_change_vtbl_record() returns an error in ubi_resize_volume(),
"new_eba_tbl" will be freed on error handing path, but it is holded
by "vol->eba_tbl" in ubi_eba_replace_table(). It means that the liftcycle
of "vol->eba_tbl" and "vol" are different, so when resizing volume in
next time, it causing an use-after-free fault.
Fix it by not freeing "new_eba_tbl" after it replaced in
ubi_eba_replace_table(), while will be freed in next volume resizing.
📍 영향받는 시스템
Linux kernel (UBI subsystem, specifically versions around 6.1.0-rc1 and earlier)
⚔️ 공격 벡터
로컬 권한을 가진 사용자가 ioctl 시스템 호출을 통해 UBI 볼륨 크기 조정을 시도하여 메모리 오류 유발
🛡️ 대응 방법
리눅스 커널을 최신 보안 패치가 적용된 버전으로 업데이트하십시오.
🔧 검증 코드
출력된 커널 버전이 취약점이 해결된 패치 버전 이후인지 확인하십시오.