🇰🇷 한글 설명
Linux kernel의 libertas WiFi 드라이버에서 타이머 삭제 시 동기화 실패로 인한 use-after-free 취약점입니다. lbs_free_adapter() 함수가 timer_delete()를 사용하여 실행 중인 타이머 콜백의 완료를 기다리지 않고 메모리를 해제하면, 콜백이 이미 해제된 메모리에 접근하게 됩니다. timer_delete_sync()를 사용하여 콜백 완료를 보장해야 합니다.
💡 쉬운 설명
WiFi 드라이버가 정리할 때 타이머를 잘못 중지하여, 아직 실행 중인 타이머 작업이 이미 삭제된 메모리에 접근합니다. 이로 인해 시스템 충돌이나 보안 침해가 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
wifi: libertas: fix use-after-free in lbs_free_adapter()
The lbs_free_adapter() function uses timer_delete() (non-synchronous)
for both command_timer and tx_lockup_timer before the structure is
freed. This is incorrect because timer_delete() does not wait for
any running timer callback to complete.
If a timer callback is executing when lbs_free_adapter() is called,
the callback will access freed memory since lbs_cfg_free() frees the
containing structure immediately after lbs_free_adapter() returns.
Both timer callbacks (lbs_cmd_timeout_handler and lbs_tx_lockup_handler)
access priv->driver_lock, priv->cur_cmd, priv->dev, and other fields,
which would all be use-after-free violations.
Use timer_delete_sync() instead to ensure any running timer callback
has completed before returning.
This bug was introduced in commit 8f641d93c38a ("libertas: detect TX
lockups and reset hardware") where del_timer() was used instead of
del_timer_sync() in the cleanup path. The command_timer has had the
same issue since the driver was first written.
📍 영향받는 시스템
Linux kernel libertas WiFi 드라이버를 포함하는 모든 Linux 배포판 (commit 8f641d93c38a 이후)
⚔️ 공격 벡터
로컬 공격자가 드라이버 종료 시점에 타이머 콜백이 실행되도록 유도하여 use-after-free 조건 생성
🛡️ 대응 방법
Linux kernel을 수정된 버전으로 업데이트하여 lbs_free_adapter()에서 timer_delete_sync() 사용 필요
🔧 검증 코드
libertas 모듈이 출력되면 시스템이 영향받을 가능성 있음, 커널 패치 여부를 uname -r로 확인