🇰🇷 한글 설명
Linux 커널의 Bluetooth HCI 동기 함수에서 스택 버퍼 오버플로우 취약점으로, BIS(Broadcast Isochronous Stream) 엔트리 개수가 18개 이상 31개 이하일 때 할당된 스택 메모리를 초과하여 인접 메모리를 손상시킵니다. ISO 소켓 바인딩 후 listen() 함수 호출로 쉽게 재현될 수 있습니다.
💡 쉬운 설명
Linux 커널의 블루투스 기능에서 메모리 할당 크기를 잘못 계산해 스택 메모리가 손상되는 문제입니다. 많은 수의 블루투스 ISO 스트림을 연결할 때 커널 충돌 또는 권한 상승이 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: hci_sync: fix stack buffer overflow in hci_le_big_create_sync
hci_le_big_create_sync() uses DEFINE_FLEX to allocate a
struct hci_cp_le_big_create_sync on the stack with room for 0x11 (17)
BIS entries. However, conn->num_bis can hold up to HCI_MAX_ISO_BIS (31)
entries — validated against ISO_MAX_NUM_BIS (0x1f) in the caller
hci_conn_big_create_sync(). When conn->num_bis is between 18 and 31,
the memcpy that copies conn->bis into cp->bis writes up to 14 bytes
past the stack buffer, corrupting adjacent stack memory.
This is trivially reproducible: binding an ISO socket with
bc_num_bis = ISO_MAX_NUM_BIS (31) and calling listen() will
eventually trigger hci_le_big_create_sync() from the HCI command
sync worker, causing a KASAN-detectable stack-out-of-bounds write:
BUG: KASAN: stack-out-of-bounds in hci_le_big_create_sync+0x256/0x3b0
Write of size 31 at addr ffffc90000487b48 by task kworker/u9:0/71
Fix this by changing the DEFINE_FLEX count from the incorrect 0x11 to
HCI_MAX_ISO_BIS, which matches the maximum number of BIS entries that
conn->bis can actually carry.
📍 영향받는 시스템
Linux 커널 2.6.33 이후 ISO 소켓 지원하는 모든 버전
⚔️ 공격 벡터
로컬 권한을 가진 사용자가 ISO 소켓을 생성한 후 최대 BIS 엔트리(31개)로 listen() 호출하여 커널 스택 메모리 손상 유발
🛡️ 대응 방법
커널 업데이트: DEFINE_FLEX count를 0x11에서 HCI_MAX_ISO_BIS(31)로 수정한 패치 적용
🔧 검증 코드
0이 출력되면 취약한 버전(HCI_MAX_ISO_BIS 패치 미적용), 1 이상이 출력되면 패치된 버전입니다. 커널 소스가 없으면 uname -r로 버전을 확인하여 수동으로 확인해야 합니다.
grep "HCI_MAX_ISO_BIS" /lib/modules/$(uname -r)/source/drivers/bluetooth/hci_sync.c 2>/dev/null | wc -l