🇰🇷 한글 설명
Linux 커널의 HID magicmouse 드라이버에서 입력 장치 등록 실패 시 stale(오래된) msc->input 포인터를 해제하지 않아 발생하는 취약점입니다. 이로 인해 잘못된 메모리 참조가 발생하여 커널 패닉이나 임의 코드 실행이 가능할 수 있습니다.
💡 쉬운 설명
마우스 드라이버가 장치를 연결하는 과정에서 오류가 발생했을 때, 이미 사용이 끝난 메모리 주소를 여전히 유효한 것으로 착각하는 문제입니다. 이로 인해 컴퓨터 시스템이 갑자기 멈추거나 보안 문제가 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
HID: magicmouse: do not keep a stale msc->input if no input is claimed
magicmouse_input_mapping() caches the first hid_input's input_dev in
msc->input while the report descriptor is parsed, and the rest of the
driver treats a non-NULL msc->input as proof that an input device was
registered.
That does not hold on the hid-input error path. If hidinput_connect()
fails -- for instance because input_register_device() returns an error --
it unwinds through hidinput_disconnect(), which frees every input_dev it
created, including the one cached in msc->input.
The failure does not abort the probe. hid_connect() only skips the claim:
if ((connect_mask & HID_CONNECT_HIDINPUT) && !hidinput_connect(hdev,
connect_mask & HID_CONNECT_HIDINPUT_FORCE))
hdev->claimed |= HID_CLAIMED_INPUT;
and the "device has no listeners" bailout below it does not fire for this
driver, which sets ->raw_event; on the USB Magic Mouse 2 / Magic Trackpad
2 paths hidraw and hiddev are claimed as well. hid_hw_start() therefore
returns 0 and magicmouse_probe() continues with msc->input pointing at
freed memory. Being non-NULL, it passes the "input not registered" check
in probe and the NULL checks in ->raw_event and ->event, so the next
input report dereferences freed memory.
Clear msc->input when the HID core did not claim an input device, so the
existing NULL checks cover this case as well.
📍 영향받는 시스템
Linux kernel (magicmouse driver 사용 시스템)
⚔️ 공격 벡터
특수하게 조작된 HID 리포트 디스크립터를 통해 입력 장치 등록 실패를 유도하여 Use-After-Free 유발
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하십시오.
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이후인지 확인하십시오.