🇰🇷 한글 설명
Linux 커널 Bluetooth MGMT 서브시스템에서 전원 종료 시 보류 중인 명령의 상태 값이 잘못 전달되는 결함이 수정되었습니다. cmd_complete_rsp()가 fall-through 경로에서 status 대신 구조체 포인터의 첫 바이트를 상태로 보내, 장치 전원 종료 시 실패해야 할 명령이 성공(0x00)으로 응답되었습니다. 이로 인해 bluetoothd가 비정상 응답을 처리하다 충돌하는 문제가 발생했습니다.
💡 쉬운 설명
Bluetooth 장치를 끌 때 대기 중이던 요청에 잘못된 '성공' 응답이 전달되는 오류가 있었습니다. 이 때문에 사용자 프로그램이 오작동하거나 충돌할 수 있었습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: MGMT: Fix status of pending commands flushed on power off
cmd_complete_rsp() receives a struct cmd_lookup and, for a pending
command that has no cmd_complete callback, falls through to
cmd_status_rsp(cmd, data). cmd_status_rsp() reads data as a u8 *, so
the status sent comes from the first byte of match->sk's
representation, not from match->mgmt_status.
commit f53e1c9c726d ("Bluetooth: MGMT: Fix possible crash on
mgmt_index_removed") changed the callers' data from &status to &match
and updated the cmd_complete branch to match->mgmt_status, but left
the fall-through passing data unchanged.
In mgmt_index_removed() match->sk is NULL, so every such command is
answered with status 0x00 (Success) instead of
MGMT_STATUS_INVALID_INDEX. In __mgmt_power_off() it is NULL too,
unless a Set Powered command was pending: then settings_rsp() has
stored that command's socket in match->sk, and the byte sent comes
from the socket pointer. Either way the status the caller set,
MGMT_STATUS_NOT_POWERED (or MGMT_STATUS_INVALID_INDEX when the device
is being unregistered), is lost.
Pass the status the callers set.
This was seen on a QCA9377 laptop: bluetoothd's Start Discovery,
pending when the adapter was powered off, was answered with Command
Status 0x00 and no parameters, and bluetoothd 5.72 crashed on the
zero-length success. BlueZ master has since added the length check
on that path ("adapter: Fix crash on short start discovery reply",
BlueZ a734b06059cb), but userspace should still be told Not Powered,
not Success.
Tested on Ubuntu 7.0.0-31 with a virtual controller (hci_vhci):
power off is held in HCI Write Scan Enable while a Start Discovery is
submitted, and the flush answers it with status 0x00 before this
change and 0x0f (Not Powered) after.
📍 영향받는 시스템
Linux 커널 Bluetooth MGMT 서브시스템을 사용하는 버전 (수정 커밋 f53e1c9c726d 이후 영향, 패치 적용 여부는 배포판 커널 버전으로 확인)
⚔️ 공격 벡터
로컬 사용자가 Bluetooth 장치 전원 종료 시점에 요청을 보내 잘못된 상태 응답을 유도하는 방식으로, 원격 공격 가능성은 확인되지 않았습니다.
🛡️ 대응 방법
배포판에서 제공하는 해당 커널 보안/버그 수정 업데이트를 설치하고 재부팅합니다.
🔧 검증 코드
출력된 커널 버전을 배포판의 보안 공지나 패치된 커널 버전과 비교하여, 수정된 빌드가 적용되었는지 확인합니다.