🇰🇷 한글 설명
Linux 커널의 at91_udc 드라이버에서 polled-VBUS 모드 사용 시, UDC 장치가 해제되기 전에 타이머와 워크 아이템이 적절히 종료되지 않는 취약점이 발견되었습니다. 이로 인해 장치 제거 또는 프로브 실패 시 이미 해제된 메모리 영역을 참조하는 Use-After-Free 문제가 발생할 수 있습니다.
💡 쉬운 설명
컴퓨터 부품을 제거할 때 작동 중이던 작업이 완전히 멈추지 않아, 이미 사라진 부품의 정보를 다시 불러오려다 시스템이 충돌하는 문제입니다. 이로 인해 시스템이 갑자기 멈추거나 보안 문제가 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
usb: gadget: at91_udc: drain polled-VBUS timer/work before udc is freed
In polled-VBUS mode (board.vbus_pin && board.vbus_polled), probe arms a
self-restarting cycle: at91_vbus_timer() schedules vbus_timer_work, and
at91_vbus_timer_work() calls at91_vbus_update() and re-arms the timer via
mod_timer(). Both recover the same udc through container_of and dereference
it on every iteration.
Neither teardown path cancels this cycle. udc is devm-allocated, so it is
freed after at91udc_remove() returns, and is likewise freed when probe
fails and devres runs. A timer callback or work item that is pending or
running at either point dereferences the freed udc.
Add at91_udc_shutdown_vbus_timer() and call it from at91udc_remove() and
from the usb_add_gadget_udc() failure path in probe; the remaining probe
error paths fail before the timer is armed. timer_shutdown_sync() waits
for a running callback and clears timer->function, which makes the work
handler's mod_timer() a permanent no-op; cancel_work_sync() then drains
any pending or running work whose re-arm attempt now does nothing. The
timer must be shut down first, since cancelling the work alone would let
the timer re-queue it. The guard mirrors probe: in IRQ mode the timer and
work_struct are never initialized.
This does not require a fault; a normal driver unbind can interleave with
an already queued work item.
This issue was found by an in-house static analysis tool.
📍 영향받는 시스템
Linux kernel (at91_udc driver using polled-VBUS mode)
⚔️ 공격 벡터
로컬 공격자가 USB 가젯 드라이버의 장치 해제(unbind) 과정을 유도하여 Use-After-Free를 유발할 수 있음
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 at91_udc_shutdown_vbus_timer() 기능이 포함된 패치를 적용해야 함
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 패치 버전 이후인지 확인하십시오.