🇰🇷 한글 설명
Linux 커널의 Bluetooth MGMT 서브시스템에서 set_ssp_complete() 함수가 메모리를 제대로 해제하지 않는 메모리 누수 취약점입니다. 이전 커밋에서 mgmt_pending_foreach() 호출을 개별 명령 처리로 변경했지만 mgmt_pending_free() 호출을 누락하여 매번 SSP 명령 완료 시 mgmt_pending_cmd 구조체 메모리가 누적되어 누수됩니다.
💡 쉬운 설명
블루투스 연결 처리 과정에서 메모리가 제대로 정리되지 않아 시간이 지나면서 메모리 낭비가 쌓입니다. 반복적으로 블루투스 기능을 사용하면 시스템의 사용 가능한 메모리가 점점 줄어들어 응답 성능이 저하됩니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: MGMT: Fix memory leak in set_ssp_complete
Fix memory leak in set_ssp_complete() where mgmt_pending_cmd structures
are not freed after being removed from the pending list.
Commit 302a1f674c00 ("Bluetooth: MGMT: Fix possible UAFs") replaced
mgmt_pending_foreach() calls with individual command handling but missed
adding mgmt_pending_free() calls in both error and success paths of
set_ssp_complete(). Other completion functions like set_le_complete()
were fixed correctly in the same commit.
This causes a memory leak of the mgmt_pending_cmd structure and its
associated parameter data for each SSP command that completes.
Add the missing mgmt_pending_free(cmd) calls in both code paths to fix
the memory leak. Also fix the same issue in set_advertising_complete().
📍 영향받는 시스템
Linux kernel 5.18 이상의 Bluetooth MGMT 기능을 사용하는 시스템 (특히 블루투스 SSP 동작을 자주 수행하는 임베디드 기기)
⚔️ 공격 벡터
로컬 권한 상승, 서비스 거부 (메모리 고갈로 인한 커널 패닉 또는 시스템 성능 저하)
🛡️ 대응 방법
Linux 커널을 최신 버전으로 업데이트하여 mgmt_pending_free() 호출이 추가된 패치를 적용
🔧 검증 코드
mgmt_pending_free 함수 호출이 set_ssp_complete() 및 set_advertising_complete() 함수의 모든 경로에 존재하면 패치된 것이고, 커널 버전이 6.5 이상이면 일반적으로 패치가 포함되어 있습니다.
grep -n 'mgmt_pending_free' /lib/modules/$(uname -r)/build/net/bluetooth/mgmt.c 2>/dev/null || uname -r | grep -qE '(6\.[5-9]|[7-9]\.)' && echo 'kernel version check: likely patched' || echo 'kernel version check: may need update'