🇰🇷 한글 설명
리눅스 커널의 Bluetooth hci_sock 모듈에서 소켓 바인드(sock bind) 작업과 소켓 쓰기 반복(socket write iter) 작업 간의 경쟁 상태(Race Condition)가 발생할 수 있습니다. 이로 인해 관리 명령어가 해제된 후 다시 참조되는 Use-After-Free(UAF) 취약점이 발생하여 시스템 불안정이나 권한 상승을 초래할 수 있습니다.
💡 쉬운 설명
블루투스 기능을 사용하는 과정에서 두 가지 작업이 동시에 충돌하여, 이미 삭제된 데이터를 다시 사용하려고 시도하는 오류가 발생합니다. 이 오류를 이용하면 해커가 시스템을 고장 내거나 제어권을 뺏을 위험이 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: hci_sock: Prevent race in socket write iter and sock bind
There is a potential race condition between sock bind and socket write
iter. bind may free the same cmd via mgmt_pending before write iter sends
the cmd, just as syzbot reported in UAF[1].
Here we use hci_dev_lock to synchronize the two, thereby avoiding the
UAF mentioned in [1].
[1]
syzbot reported:
BUG: KASAN: slab-use-after-free in mgmt_pending_remove+0x3b/0x210 net/bluetooth/mgmt_util.c:316
Read of size 8 at addr ffff888077164818 by task syz.0.17/5989
Call Trace:
mgmt_pending_remove+0x3b/0x210 net/bluetooth/mgmt_util.c:316
set_link_security+0x5c2/0x710 net/bluetooth/mgmt.c:1918
hci_mgmt_cmd+0x9c9/0xef0 net/bluetooth/hci_sock.c:1719
hci_sock_sendmsg+0x6ca/0xef0 net/bluetooth/hci_sock.c:1839
sock_sendmsg_nosec net/socket.c:727 [inline]
__sock_sendmsg+0x21c/0x270 net/socket.c:742
sock_write_iter+0x279/0x360 net/socket.c:1195
Allocated by task 5989:
mgmt_pending_add+0x35/0x140 net/bluetooth/mgmt_util.c:296
set_link_security+0x557/0x710 net/bluetooth/mgmt.c:1910
hci_mgmt_cmd+0x9c9/0xef0 net/bluetooth/hci_sock.c:1719
hci_sock_sendmsg+0x6ca/0xef0 net/bluetooth/hci_sock.c:1839
sock_sendmsg_nosec net/socket.c:727 [inline]
__sock_sendmsg+0x21c/0x270 net/socket.c:742
sock_write_iter+0x279/0x360 net/socket.c:1195
Freed by task 5991:
mgmt_pending_free net/bluetooth/mgmt_util.c:311 [inline]
mgmt_pending_foreach+0x30d/0x380 net/bluetooth/mgmt_util.c:257
mgmt_index_removed+0x112/0x2f0 net/bluetooth/mgmt.c:9477
hci_sock_bind+0xbe9/0x1000 net/bluetooth/hci_sock.c:1314
📍 영향받는 시스템
Linux Kernel (Bluetooth hci_sock 관련 모듈이 포함된 버전)
⚔️ 공격 벡터
로컬 공격자가 블루투스 소켓 바인드와 쓰기 작업을 정밀하게 타이밍을 맞춰 동시에 수행하여 메모리 오류 유도
🛡️ 대응 방법
hci_dev_lock을 사용하여 동기화가 적용된 최신 리눅스 커널 버전으로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 패치된 최신 보안 업데이트 버전인지 확인