🇰🇷 한글 설명
Linux 커널의 Bluetooth SCO 구현 중 sco_sock_connect() 함수에서 소켓 잠금 없이 상태를 확인하여 발생하는 레이스 컨디션 취약점입니다. 두 개의 connect() 시스템 호출이 동시에 발생할 경우 소켓 상태가 비정상적으로 복구되어 Use-After-Free 및 메모리 누수를 유발할 수 있습니다.
💡 쉬운 설명
블루투스 연결을 시도할 때 두 명령이 동시에 들어오면 컴퓨터가 혼란을 겪어 이미 닫힌 연결을 다시 살려내는 오류입니다. 이 과정에서 메모리 관리 오류가 발생하여 시스템이 불안정해지거나 해킹에 이용될 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: SCO: fix race conditions in sco_sock_connect()
sco_sock_connect() checks sk_state and sk_type without holding
the socket lock. Two concurrent connect() syscalls on the same
socket can both pass the check and enter sco_connect(), leading
to use-after-free.
The buggy scenario involves three participants and was confirmed
with additional logging instrumentation:
Thread A (connect): HCI disconnect: Thread B (connect):
sco_sock_connect(sk) sco_sock_connect(sk)
sk_state==BT_OPEN sk_state==BT_OPEN
(pass, no lock) (pass, no lock)
sco_connect(sk): sco_connect(sk):
hci_dev_lock hci_dev_lock
hci_connect_sco <- blocked
-> hcon1
sco_conn_add->conn1
lock_sock(sk)
sco_chan_add:
conn1->sk = sk
sk->conn = conn1
sk_state=BT_CONNECT
release_sock
hci_dev_unlock
hci_dev_lock
sco_conn_del:
lock_sock(sk)
sco_chan_del:
sk->conn=NULL
conn1->sk=NULL
sk_state=
BT_CLOSED
SOCK_ZAPPED
release_sock
hci_dev_unlock
(unblocked)
hci_connect_sco
-> hcon2
sco_conn_add
-> conn2
lock_sock(sk)
sco_chan_add:
sk->conn=conn2
sk_state=
BT_CONNECT
// zombie sk!
release_sock
hci_dev_unlock
Thread B revives a BT_CLOSED + SOCK_ZAPPED socket back to
BT_CONNECT. Subsequent cleanup triggers double sock_put() and
use-after-free. Meanwhile conn1 is leaked as it was orphaned
when sco_conn_del() cleared the association.
Fix this by:
- Moving lock_sock() before the sk_state/sk_type checks in
sco_sock_connect() to serialize concurrent connect attempts
- Fixing the sk_type != SOCK_SEQPACKET check to actually
return the error instead of just assigning it
- Adding a state re-check in sco_connect() after lock_sock()
to catch state changes during the window between the locks
- Adding sco_pi(sk)->conn check in sco_chan_add() to prevent
double-attach of a socket to multiple connections
- Adding hci_conn_drop() on sco_chan_add failure to prevent
HCI connection leaks
📍 영향받는 시스템
Linux Kernel (Bluetooth SCO 관련 모듈 사용 시스템)
⚔️ 공격 벡터
동일한 블루투스 소켓에 대해 동시에 여러 개의 connect() 시스템 호출을 시도하는 레이스 컨디션 공격
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 sco_sock_connect()의 잠금 메커니즘을 수정해야 합니다.
🔧 검증 코드
출력된 커널 버전을 확인하여 해당 취약점이 해결된 패치 버전인지 보안 공지(CVE-2026-43023 관련)와 대조하십시오.