🇰🇷 한글 설명
Linux 커널의 ALSA us144mkii 드라이버에서 USB URB 재제출 시 앵커링(anchoring)이 누락되는 취약점이 발견되었습니다. 이로 인해 장치 연결 해제나 중지 시 앵커링된 URB를 제대로 회수하지 못해, 이미 해제된 메모리 영역에 데이터를 쓰거나 참조하는 Use-After-Free 오류가 발생할 수 있습니다.
💡 쉬운 설명
USB 오디오 장치를 사용할 때, 장치를 갑자기 뽑거나 시스템이 잠들면 컴퓨터가 이미 삭제된 메모리 공간을 잘못 건드려 시스템이 충돌하거나 오류가 발생할 수 있는 문제입니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
ALSA: us144mkii: re-anchor capture URBs on resubmission
capture_urb_complete() resubmits each capture URB without anchoring it:
usb_get_urb(urb);
ret = usb_submit_urb(urb, GFP_ATOMIC);
Anchoring is a property of a submission, not of the URB. The giveback
path calls usb_unanchor_urb() before urb->complete(), so an URB
resubmitted from its own completion handler is off the anchor. The
capture URBs are anchored once, at stream start, so from the first
completion onward tascam->capture_anchor is empty.
tascam_free_urbs(), tascam_disconnect(), tascam_suspend() and the
stop-work path all call usb_kill_anchored_urbs(&tascam->capture_anchor)
to reap the capture URBs before anything is freed. With the anchor empty
those calls return immediately and the URBs stay queued on the host
controller.
tascam_free_urbs() then returns the capture transfer buffers with
usb_free_coherent(), and snd_card_free() releases the snd_card
allocation that embeds tascam (card->private_data). The controller
completes the queued URBs afterwards, writing device-supplied data into
the freed transfer buffer, and capture_urb_complete() dereferences the
freed driver object.
KASAN on 7.2.0-rc5 (arm64):
BUG: KASAN: slab-use-after-free in dummy_timer
Write of size 512 at addr ffff000015b62000
__asan_memcpy
dummy_timer
hrtimer_run_softirq
Allocated by task 64:
usb_alloc_coherent
tascam_alloc_urbs
tascam_probe
Freed by task 170:
usb_free_coherent
tascam_free_urbs
tascam_disconnect
usb_unbind_interface
BUG: KASAN: slab-use-after-free in capture_urb_complete
Read of size 4 at addr ffff0000170ee878
Freed by task 170:
release_card_device
snd_card_free
tascam_disconnect
Restore the usb_anchor_urb() between the reference count bump and the
resubmission. That also makes the handler's usb_unanchor_urb() failure
arm meaningful again and restores usb_kill_anchored_urbs() as a barrier
on the disconnect, suspend and stop-work paths.
The anchoring was removed on the premise that the URB is already anchored
from the initial submission, which does not hold once the first giveback
has run.
Discovered by XBOW, triaged by Baul Lee <
[email protected]>
📍 영향받는 시스템
Linux kernel (ALSA us144mkii driver 사용 환경)
⚔️ 공격 벡터
물리적 장치 연결 해제 또는 시스템 절전 모드 진입을 통한 메모리 오류 유도
🛡️ 대응 방법
USB URB 재제출 시 usb_anchor_urb()를 호출하도록 커널 패치 적용
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 최신 패치 버전인지 확인