🔍 CVE-2025-38016

8.8
CVSS Score
HIGH
2025-06-18
2026-07-30 06:22
✅ 완료

🇰🇷 한글 설명

리눅스 커널의 HID BPF 구현에서 장치가 제거된 후에도 SRCU(Sleepable Read-Copy Update) 구조체에 접근하여 발생하는 취약점입니다. 특정 LED가 켜진 HID 장치를 연결 해제할 때, 구현되지 않은 요청을 처리하는 과정에서 이미 해제된 메모리 영역을 참조하여 시스템 오류나 데이터 손상을 유발할 수 있습니다.

💡 쉬운 설명

컴퓨터에서 마우스나 키보드 같은 장치를 뽑을 때, 시스템이 이미 사라진 장치의 정보를 잘못된 메모리 주소에서 찾으려고 시도하는 문제입니다. 이로 인해 시스템이 갑자기 멈추거나 예상치 못한 오류가 발생할 수 있습니다.

🇺🇸 원문 (English)

In the Linux kernel, the following vulnerability has been resolved: HID: bpf: abort dispatch if device destroyed The current HID bpf implementation assumes no output report/request will go through it after hid_bpf_destroy_device() has been called. This leads to a bug that unplugging certain types of HID devices causes a cleaned- up SRCU to be accessed. The bug was previously a hidden failure until a recent x86 percpu change [1] made it access not-present pages. The bug will be triggered if the conditions below are met: A) a device under the driver has some LEDs on B) hid_ll_driver->request() is uninplemented (e.g., logitech-djreceiver) If condition A is met, hidinput_led_worker() is always scheduled *after* hid_bpf_destroy_device(). hid_destroy_device ` hid_bpf_destroy_device ` cleanup_srcu_struct(&hdev->bpf.srcu) ` hid_remove_device ` ... ` led_classdev_unregister ` led_trigger_set(led_cdev, NULL) ` led_set_brightness(led_cdev, LED_OFF) ` ... ` input_inject_event ` input_event_dispose ` hidinput_input_event ` schedule_work(&hid->led_work) [hidinput_led_worker] This is fine when condition B is not met, where hidinput_led_worker() calls hid_ll_driver->request(). This is the case for most HID drivers, which implement it or use the generic one from usbhid. The driver itself or an underlying driver will then abort processing the request. Otherwise, hidinput_led_worker() tries hid_hw_output_report() and leads to the bug. hidinput_led_worker ` hid_hw_output_report ` dispatch_hid_bpf_output_report ` srcu_read_lock(&hdev->bpf.srcu) ` srcu_read_unlock(&hdev->bpf.srcu, idx) The bug has existed since the introduction [2] of dispatch_hid_bpf_output_report(). However, the same bug also exists in dispatch_hid_bpf_raw_requests(), and I've reproduced (no visible effect because of the lack of [1], but confirmed bpf.destroyed == 1) the bug against the commit (i.e., the Fixes:) introducing the function. This is because hidinput_led_worker() falls back to hid_hw_raw_request() when hid_ll_driver->output_report() is uninplemented (e.g., logitech- djreceiver). hidinput_led_worker ` hid_hw_output_report: -ENOSYS ` hid_hw_raw_request ` dispatch_hid_bpf_raw_requests ` srcu_read_lock(&hdev->bpf.srcu) ` srcu_read_unlock(&hdev->bpf.srcu, idx) Fix the issue by returning early in the two mentioned functions if hid_bpf has been marked as destroyed. Though dispatch_hid_bpf_device_event() handles input events, and there is no evidence that it may be called after the destruction, the same check, as a safety net, is also added to it to maintain the consistency among all dispatch functions. The impact of the bug on other architectures is unclear. Even if it acts as a hidden failure, this is still dangerous because it corrupts whatever is on the address calculated by SRCU. Thus, CC'ing the stable list. [1]: commit 9d7de2aa8b41 ("x86/percpu/64: Use relative percpu offsets") [2]: commit 9286675a2aed ("HID: bpf: add HID-BPF hooks for hid_hw_output_report")

📍 영향받는 시스템

HID-BPF 기능이 활성화된 리눅스 커널 (dispatch_hid_bpf_output_report 도입 이후 버전)

⚔️ 공격 벡터

특정 조건(LED 활성화 및 특정 드라이버 미구현)을 가진 HID 장치를 연결 해제하여 유도

🛡️ 대응 방법

HID BPF dispatch 함수 내에 장치 파괴 여부를 확인하는 로직이 포함된 최신 커널로 업데이트

🔧 검증 코드

출력된 커널 버전이 해당 취약점이 패치된 최신 안정화 버전인지 확인하십시오.

Shell / Script
uname -r

📊 CVSS Vector String

CVSS Vector
CVSS:3.1/AV:A/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

💻 영향받는 소프트웨어

Linux Kernel