🇰🇷 한글 설명
Linux 커널의 Bluetooth 스택에서 SMP 원격 OOB 데이터 접근 시 동기화 문제가 발생합니다. build_pairing_cmd() 함수가 hdev->lock을 보유하지 않은 상태에서 데이터를 복사하여, 데이터가 삭제되는 동안 접근을 시도할 경우 Use-After-Free 취약점이 발생할 수 있습니다.
💡 쉬운 설명
블루투스 연결 과정에서 필요한 정보를 읽는 도중에 해당 정보가 갑자기 삭제되어 시스템이 충돌하거나 오류가 발생하는 문제입니다. 이로 인해 메모리 관리 오류가 발생하여 시스템 안정성에 영향을 줄 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: Serialize SMP remote OOB data access
build_pairing_cmd() looks up remote OOB data and copies its contents
without holding hdev->lock, which serializes the list's writers. After
SMP finds an entry, a concurrent management Remove Remote OOB Data
command can unlink and free it before SMP reads its present flag or
copies its random and confirmation values. Removal can also invalidate
an entry while the lookup is still traversing the list.
KASAN reported:
BUG: KASAN: slab-use-after-free in build_pairing_cmd+0x948/0x9b0
Call Trace:
build_pairing_cmd+0x948/0x9b0
smp_recv_cb+0x459f/0x8110
l2cap_recv_frame+0xf14/0x9190
l2cap_recv_acldata+0xa64/0xd40
hci_rx_work+0x4ca/0x730
Allocated by task 87:
hci_add_remote_oob_data+0x11d/0x530
add_remote_oob_data+0x282/0x400
hci_sock_sendmsg+0x1033/0x1ea0
Freed by task 93:
hci_remote_oob_data_clear+0x108/0x1c0
remove_remote_oob_data+0x198/0x220
hci_sock_sendmsg+0x1033/0x1ea0
Taking hdev->lock in build_pairing_cmd() would recurse for callers that
already hold it and invert the device-to-L2CAP lock order on the receive
path. Add a per-device remote_oob_lock instead, held across the SMP
lookup and copies and by the add, remove and clear helpers. Cover
initialization and in-place updates as well, so SMP cannot read partially
initialized or updated OOB values. Release the mutex on allocation
failure, preserving the existing error return.
The new critical sections acquire no device, connection or channel locks.
Writers retain their existing hdev->lock protection, which continues to
serialize the other readers without changing their locking or behavior.
📍 영향받는 시스템
Linux Kernel (Bluetooth SMP implementation)
⚔️ 공격 벡터
원격의 공격자가 블루투스 연결 요청 및 데이터 삭제 명령을 정밀하게 조작하여 메모리 오류 유도
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 per-device remote_oob_lock이 적용된 패치를 적용해야 합니다.
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 패치 버전 이후인지 확인합니다.