🇰🇷 한글 설명
Linux 커널 Bluetooth 하위 시스템의 hci_sync 모듈에서, PA 동기화 스캔 설정 중 명령 skb의 수명 관리가 잘못되어 use-after-free가 발생하는 문제입니다. 스캔 워커와 명령 워커가 서로 다른 워크큐에서 실행되면서 해제된 메모리를 참조할 수 있습니다. 해당 커널 패치는 hdev->lock으로 주소 스냅샷과 sent_cmd 교체를 직렬화하여 문제를 해결합니다.
💡 쉬운 설명
Bluetooth 기능을 처리하는 리눅스 커널 코드에서 메모리를 이미 해제한 뒤에도 그 메모리를 다시 읽는 실수가 있었습니다. 이로 인해 시스템이 불안정해지거나 악의적인 코드가 실행될 가능성이 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: hci_sync: Fix command skb lifetime during scan setup
During PA sync scan setup, hci_le_set_ext_scan_param_sync() gets the
address used for the PA_LINK lookup from hci_sent_cmd_data(). The
returned pointer borrows storage from sent_cmd or req_skb, without
holding a reference to either skb.
The scan worker runs on req_workqueue while hci_cmd_work() runs on the
separate device workqueue. After the scan worker loads sent_cmd, the
command worker can free and replace it before hci_sent_cmd_data()
dereferences the skb. The command payload can also be freed between
returning from the helper and comparing the address. The connection
lookup's RCU critical section does not protect the command skb.
KASAN reported:
BUG: KASAN: slab-use-after-free in hci_sent_cmd_data+0x27c/0x2f0
Workqueue: hci0 hci_cmd_sync_work
Call Trace:
hci_sent_cmd_data+0x27c/0x2f0
hci_le_set_scan_param_sync+0x43a/0x850
hci_passive_scan_sync+0xb09/0x1460
hci_update_passive_scan_sync+0x47c/0x6e0
hci_le_pa_create_sync+0x200/0xa70
hci_cmd_sync_work+0x13c/0x290
Allocated by task 95:
skb_clone+0x13f/0x340
hci_cmd_work+0x2a9/0x7e0
Freed by task 95:
kmem_cache_free+0xba/0x3a0
hci_cmd_work+0x29c/0x7e0
Use hdev->lock to serialize the address snapshot with sent_cmd
replacement. Protect req_skb replacement and completion cleanup with
the same lock because the helper falls back to that skb. Copy the
address before releasing the lock and use the copy for the existing
RCU-protected connection lookup. Release the mutex before sending or
waiting for commands, preserving the lookup and completion ordering.
📍 영향받는 시스템
수정 이전의 Linux 커널 (Bluetooth 하위 시스템 사용 환경, 정확한 영향 버전은 공식 커밋 기준 확인 필요)
⚔️ 공격 벡터
근접한 공격자가 Bluetooth 통신 흐름을 조작해 커널 메모리 해제 타이밍을 유발하는 방식으로 악용될 수 있으나, 구체적인 익스플로잇 조건은 명시되지 않음
🛡️ 대응 방법
패치가 포함된 최신 Linux 커널 버전으로 업데이트하고 재부팅합니다.
🔧 검증 코드
출력된 커널 버전이 배포판의 보안 권고에서 수정된 버전 이상인지 비교하고, 수정 커밋 포함 여부는 배포판 패키지 변경 로그로 확인합니다.