🔍 CVE-2026-99039

0.0
CVSS Score
UNKNOWN
2026-10-23
2026-10-23 13:17
✅ 완료

🇰🇷 한글 설명

Linux 커널의 memstick 코어에서 장치 식별 및 주소 설정 요청 대기 시 wait_for_completion_timeout()을 사용해, 타임아웃 후 아직 진행 중인 비동기 요청이 이미 해제된 card 구조체에 쓰기를 수행하는 use-after-free 문제가 있습니다. 이를 wait_for_completion()으로 교체하여 요청 완료 전 구조체가 해제되지 않도록 수정했습니다.

💡 쉬운 설명

메모리 카드 장치를 인식하는 과정에서 시간 제한이 지나면 아직 작업 중인 데이터가 이미 지워진 메모리 영역에 쓰여져 시스템이 불안정해질 수 있습니다. 작업이 끝날 때까지 기다리도록 수정하여 이 문제를 막았습니다.

🇺🇸 원문 (English)

In the Linux kernel, the following vulnerability has been resolved: memstick: core: wait for request completion before freeing card In memstick_alloc_card() and memstick_set_rw_addr(), wait_for_completion_timeout() is used to wait for device identification and address configuration requests to complete. The memstick subsystem does not provide an abort or cancellation callback in struct memstick_host for in-flight requests. If wait_for_completion_timeout() expires (for instance, when a USB transfer or command retry is delayed), memstick_alloc_card() returns an error and frees the memstick_dev structure via kfree(card). However, the host controller driver (such as rtsx_usb_ms) is still running the request asynchronously in worker context. When the transfer eventually finishes, the driver writes into host->req->data, which points to memory inside the already freed card structure. This leads to a KASAN slab-use-after-free write: BUG: KASAN: slab-use-after-free in ms_read_bytes+0x8fe/0x990 Write of size 1 at addr ffff88813c188079 by task kworker/1:5/5239 Workqueue: events rtsx_usb_ms_handle_req Call Trace: ms_read_bytes+0x8fe/0x990 drivers/memstick/host/rtsx_usb_ms.c:450 rtsx_usb_ms_issue_cmd drivers/memstick/host/rtsx_usb_ms.c:477 [inline] rtsx_usb_ms_handle_req+0x557/0x1a00 drivers/memstick/host/rtsx_usb_ms.c:531 process_one_work+0xac7/0x1b10 kernel/workqueue.c:3396 worker_thread+0x5ef/0xe50 kernel/workqueue.c:3560 kthread+0x373/0x450 kernel/kthread.c:436 Allocated by task 1662: memstick_alloc_card drivers/memstick/core/memstick.c:383 [inline] memstick_check+0x2c1/0x10d0 drivers/memstick/core/memstick.c:452 process_one_work+0xac7/0x1b10 kernel/workqueue.c:3396 Freed by task 1662: kfree+0x20c/0x650 mm/slub.c:6792 memstick_alloc_card drivers/memstick/core/memstick.c:420 [inline] memstick_check+0x72b/0x10d0 drivers/memstick/core/memstick.c:452 process_one_work+0xac7/0x1b10 kernel/workqueue.c:3396 Host controller drivers (rtsx_usb_ms, jmb38x_ms, tifm_ms, r592) already implement their own hardware and bus timeouts, and callers in mspro_block and ms_block already rely on wait_for_completion() unconditionally. Replace wait_for_completion_timeout() with wait_for_completion() in memstick_set_rw_addr() and memstick_alloc_card() so that the card structure is never freed while an asynchronous request is in flight.

📍 영향받는 시스템

메모리 스틱(memstick) 드라이버를 포함한 수정 이전의 Linux 커널 (rtsx_usb_ms 등 호스트 컨트롤러 드라이버 사용 환경)

⚔️ 공격 벡터

USB 전송 지연 등으로 타임아웃이 발생하도록 조작된 장치를 연결해 커널 메모리 손상(use-after-free)을 유발하는 방식이며, 충돌 또는 권한 상승으로 이어질 가능성이 있습니다.

🛡️ 대응 방법

패치가 포함된 최신 Linux 커널로 업데이트하거나 배포판 보안 업데이트를 적용합니다.

🔧 검증 코드

커널 버전을 확인하고, 출력된 memstick.c에서 wait_for_completion_timeout이 없으면 패치가 적용된 것이고, 여전히 있으면 취약한 상태입니다 (소스 경로가 없으면 배포판 패키지 changelog로 확인).

Shell / Script
uname -r && grep -rn 'wait_for_completion_timeout' /usr/src/linux/drivers/memstick/core/memstick.c 2>/dev/null

💻 영향받는 소프트웨어

Linux Kernel