🇰🇷 한글 설명
리눅스 커널의 Bluetooth RFCOMM 모듈에서 set_termios 함수 호출 시 세션 사용 후 해제(Use-After-Free) 취약점이 발견되었습니다. rfcomm_mutex 락을 적절히 확보하지 않은 상태에서 세션 포인터를 참조하여, 다른 프로세스가 세션을 해제할 경우 메모리 오류가 발생할 수 있습니다.
💡 쉬운 설명
블루투스 통신을 설정하는 과정에서 이미 삭제된 통신 정보를 다시 사용하려고 시도할 때 발생하는 오류입니다. 이로 인해 시스템이 충돌하거나 보안 문제가 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: RFCOMM: Fix session UAF in set_termios
rfcomm_tty_set_termios() tests dlc->session without rfcomm_mutex and
later passes the pointer to rfcomm_send_rpn(). The latter dereferences
both session->initiator and session->sock. Meanwhile, krfcommd can
unlink the DLC and free the session while holding rfcomm_mutex.
The race can proceed as follows:
TTY ioctl task krfcommd
-------------- --------
load dlc->session
enter rfcomm_send_rpn()
lock rfcomm_mutex
clear dlc->session
free session
unlock rfcomm_mutex
read session->initiator
KASAN reported:
BUG: KASAN: slab-use-after-free in rfcomm_send_rpn+0x297/0x2a0
Read of size 4 at addr ffff88810012a850 by task poc/92
Call Trace:
rfcomm_send_rpn+0x297/0x2a0
rfcomm_tty_set_termios+0x50d/0x850
tty_set_termios+0x596/0x950
set_termios+0x46a/0x6e0
tty_mode_ioctl+0x152/0xbd0
tty_ioctl+0x915/0x1240
__x64_sys_ioctl+0x134/0x1c0
Allocated by task 92:
rfcomm_session_add+0x9e/0x2e0
rfcomm_dlc_open+0x8b1/0xe00
rfcomm_dev_activate+0x85/0x1a0
rfcomm_tty_open+0x90/0x280
Freed by task 68:
kfree+0x131/0x3c0
rfcomm_session_del+0x119/0x180
rfcomm_run+0x737/0x4710
Add rfcomm_dlc_send_rpn(), which holds rfcomm_mutex while it verifies
that the DLC is still attached and sends the RPN frame. Have the TTY
path use the helper and drop its unlocked session check. This keeps the
session valid through both the frame construction and socket send.
📍 영향받는 시스템
Linux Kernel (Bluetooth RFCOMM module)
⚔️ 공격 벡터
로컬 사용자가 TTY ioctl을 통해 특정 블루투스 RFCOMM 세션 조작 시 레이스 컨디션 유발
🛡️ 대응 방법
리눅스 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 rfcomm_dlc_send_helper 함수가 적용된 패치를 적용하십시오.
🔧 검증 코드
출력된 커널 버전이 취약점이 해결된 최신 패치 버전인지 확인하십시오.