🇰🇷 한글 설명
Linux 커널의 vub300 드라이버에서 probe 실패 시 발생하는 Use-After-Free 취약점입니다. mmc_add_host()가 실패할 때 참조 카운트(kref) 메커니즘을 무시하고 mmc_free_host()를 직접 호출하여, 이미 예약된 타이머 작업이 메모리를 참조할 때 오류가 발생할 수 있습니다.
💡 쉬운 설명
장치를 연결하는 과정에서 오류가 발생했을 때, 시스템이 메모리를 정리하는 순서가 잘못되어 이미 삭제된 데이터를 다시 사용하려고 시도하는 문제입니다. 이로 인해 시스템이 불안정해지거나 충돌이 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
mmc: vub300: fix use-after-free on probe failure
The vub300 driver lifetime-manages its controller state using
vub300->kref, with vub300_delete() freeing the mmc host when the last
reference is dropped. The probe error path after the inactivity timer has
been armed still bypasses that lifetime rule, however, and falls through
to mmc_free_host() directly if mmc_add_host() fails.
The race window is between arming the inactivity timer and reaching the
probe error unwind after mmc_add_host() fails:
probe thread timer/workqueue
------------ ---------------
kref_init(&vub300->kref) ref = 1
kref_get(&vub300->kref) ref = 2, timer ref
add_timer(inactivity_timer) fires after one second
|
| race window
|<---------------------------------------------------->
|
mmc_add_host(mmc)
inactivity timer fires
vub300_queue_dead_work()
kref_get() ref = 3
queue_work(deadwork)
mmc_add_host() fails
timer_delete_sync()
mmc_free_host(mmc)
frees vub300
deadwork runs
use-after-free
The inactivity timeout is one second, so this would require
mmc_add_host() to both fail and take more than one second to do so. This
is unlikely to happen in practice, but the error path is still wrong.
timer_delete_sync() only waits for the timer callback itself. It does
not flush deadwork that the callback may already have queued. As a
result, queued deadwork can still hold a kref while the probe error path
directly frees the backing mmc host, including the vub300 storage.
Fix this by using the same lifetime mechanism as disconnect. Clear
vub300->interface so that the timer callback and any queued deadwork
return early and drop their references, then drop the initial probe
reference and return without falling through to err_free_host.
📍 영향받는 시스템
Linux kernel (vub300 driver 포함 버전)
⚔️ 공격 벡터
로컬 공격자가 특정 하드웨어 드라이버의 초기화 과정에서 오류를 유도하여 메모리 손상을 일으킬 수 있음
🛡️ 대응 방법
Linux 커널을 최신 패치가 적용된 버전으로 업데이트하여 vub300 드라이버의 참조 카운트 관리 로직을 수정해야 함
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이후인지 확인하십시오.