🇰🇷 한글 설명
Linux 커널의 mwifiex 드라이버에서 대기 중인 명령이 중단될 경우, 호출자가 할당한 스택 메모리 버퍼를 해제하지 않아 발생하는 스택 손상 취약점입니다. 명령 대기 중 인터럽트가 발생하면 호출자는 스택 객체를 해제하지만, 이후 도착한 펌웨어 응답이 이미 해제된 스택 주소에 데이터를 쓰면서 커널 패닉을 유발할 수 있습니다.
💡 쉬운 설명
와이파이 기능을 사용하는 과정에서 명령이 중간에 끊기면, 컴퓨터가 이미 사용이 끝났다고 생각하는 메모리 공간에 잘못된 정보를 적어버리는 문제입니다. 이로 인해 시스템이 갑자기 멈추거나(커널 패닉) 데이터가 깨질 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
wifi: mwifiex: Detach sync cmd buffer on interrupted wait
mwifiex synchronous commands keep the caller-provided data buffer in
cmd_node->data_buf. Several callers pass stack-allocated objects there.
If wait_event_interruptible_timeout() is interrupted, the caller can
return and release that stack object while the firmware command is still
the current command. A late firmware response then reaches the normal
response handler, which can copy data through cmd_node->data_buf into the
stale stack address.
This fixes a stack corruption observed during repeated association and
disassociation cycles. The panic trace showed the command wait being
interrupted immediately before a bad pointer dereference:
cmd_wait_q terminated: -512
Unable to handle kernel paging request at virtual address 002c583837384662
Kernel panic - not syncing: stack-protector: Kernel stack is corrupted
...
Tainted: [M]=MACHINE_CHECK
The fault address decodes as little-endian ASCII:
0x002c583837384662 -> "bF878X,\0"
which is a fragment of the VERSION_EXT firmware string exposed as
debugfs "verext":
w8997o-V4, RF878X, FP92, 16.92.21.p153.7
The same runs also showed corrupted control data containing:
0x2400372e333531 -> "153.7\0$"
which is the tail of the same VERSION_EXT string. This points at a late
VERSION_EXT response writing through a stale stack-backed data_buf after
the interrupted wait returned.
After cancelling pending commands on an interrupted or timed-out wait,
detach the caller-owned data buffer from the still-current command. This
preserves the existing command cancellation behaviour while preventing a
late response from writing through a pointer whose lifetime ended with the
waiting caller.
Tested on an i.MX8MP board using an 88W8997.
📍 영향받는 시스템
Linux kernel (mwifiex driver 사용 시스템)
⚔️ 공격 벡터
반복적인 와이파이 연결 및 해제 사이클을 통해 인터럽트를 유도하여 스택 손상 유발
🛡️ 대응 방법
커널 패치를 적용하여 명령 중단 시 호출자가 소유한 데이터 버퍼를 분리(detach)하도록 업데이트
🔧 검증 코드
현재 실행 중인 커널 버전을 확인하여 해당 취약점이 수정된 최신 패치 버전인지 확인합니다.