🇰🇷 한글 설명
Linux 커널의 /proc/allocinfo 인터페이스에서 모듈 언로드 시 발생하는 Use-After-Free 취약점입니다. allocinfo_stop() 과정에서 모듈 잠금이 해제되는 사이 모듈이 메모리에서 해제될 수 있으며, 이후 재시작된 반복자가 해제된 메모리 영역을 참조하여 발생합니다.
💡 쉬운 설명
시스템의 정보를 읽어오는 과정에서, 사용 중인 프로그램이 갑자기 메모리에서 사라져 버려 발생하는 오류입니다. 이로 인해 시스템이 불안정해지거나 보안 문제가 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
alloc_tag: fix use-after-free in /proc/allocinfo after module unload
allocinfo_start() only reinitializes the codetag iterator at position 0.
For subsequent reads (position > 0), it reuses cached iterator state from
the previous batch. allocinfo_stop() drops mod_lock between read batches,
which allows module unload to complete and free the module memory that the
cached iterator still references:
CPU0 (read) CPU1 (rmmod)
---- ----
allocinfo_start(pos=0)
down_read(mod_lock)
allocinfo_show()
...
allocinfo_stop()
up_read(mod_lock)
codetag_unload_module()
kfree(cmod)
release_module_tags()
...
free_mod_mem()
allocinfo_start(pos=N)
down_read(mod_lock)
// reuses cached iter, skips re-init
allocinfo_show()
ct->filename <-- UAF
After free_mod_mem() frees the module's .rodata, allocinfo_show()
dereferences ct->filename, ct->function which point there.
Save the iterator state in allocinfo_next() and resume from it in
allocinfo_start() with codetag_next_ct(), which detects module removal via
idr_find() returning NULL and skips to the next module.
📍 영향받는 시스템
Linux Kernel (module unload 관련 /proc/allocinfo 사용 환경)
⚔️ 공격 벡터
로컬 사용자가 모듈 언로드와 /proc/allocinfo 읽기 작업을 교차 실행하여 메모리 참조 오류 유도
🛡️ 대응 방법
커널 패치를 적용하여 allocinfo_start() 시 모듈 제거 여부를 확인하도록 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 최신 패치 버전인지 확인