🇰🇷 한글 설명
Linux 커널의 USB gadget 구성 요소에서 composite_dev_cleanup() 함수 호출 시 Use-After-Free 취약점이 발생합니다. kmalloc 실패 시 os_desc_req 포인터가 해제된 후 NULL로 설정되지 않아, 이후 정리 과정에서 이미 해제된 메모리에 접근하게 됩니다.
💡 쉬운 설명
컴퓨터가 USB 장치를 설정하는 과정에서 메모리 관리 실수로 인해 이미 사용이 끝난 메모리 공간을 다시 사용하려고 시도하는 문제입니다. 이로 인해 시스템이 멈추거나 보안 공격에 취약해질 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
usb: gadget : fix use-after-free in composite_dev_cleanup()
1. In func configfs_composite_bind() -> composite_os_desc_req_prepare():
if kmalloc fails, the pointer cdev->os_desc_req will be freed but not
set to NULL. Then it will return a failure to the upper-level function.
2. in func configfs_composite_bind() -> composite_dev_cleanup():
it will checks whether cdev->os_desc_req is NULL. If it is not NULL, it
will attempt to use it.This will lead to a use-after-free issue.
BUG: KASAN: use-after-free in composite_dev_cleanup+0xf4/0x2c0
Read of size 8 at addr 0000004827837a00 by task init/1
CPU: 10 PID: 1 Comm: init Tainted: G O 5.10.97-oh #1
kasan_report+0x188/0x1cc
__asan_load8+0xb4/0xbc
composite_dev_cleanup+0xf4/0x2c0
configfs_composite_bind+0x210/0x7ac
udc_bind_to_driver+0xb4/0x1ec
usb_gadget_probe_driver+0xec/0x21c
gadget_dev_desc_UDC_store+0x264/0x27c
📍 영향받는 시스템
Linux kernel (USB gadget driver 사용 환경)
⚔️ 공격 벡터
USB gadget 구성 시 메모리 할당 실패를 유도하여 취약한 코드 경로를 실행
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이후인지 확인