🇰🇷 한글 설명
WNC-M14A2A LTE-M 모뎀 드라이버의 on_cmd_socknotifyev() 함수에서 %NOTIFYEV: 비요청 이벤트 처리 시, 40바이트 스택 버퍼를 넘어서 따옴표 구분자 스캔 루프가 진행되어 범위 외 스택 메모리를 읽고, 경우에 따라 범위 외 NUL 쓰기가 발생한다. 이로 인해 스택 정보 노출 및 모뎀 RX 스레드 충돌(서비스 거부)이 발생할 수 있다.
💡 쉬운 설명
LTE 모뎀이 받은 특정 네트워크 메시지를 처리할 때 정해진 메모리 범위를 넘어 읽고 쓰는 결함입니다. 공격자가 악성 기지국 등을 통해 이를 유발하면 모뎀 기능이 멈추거나 내부 메모리 정보가 새어 나갈 수 있습니다.
🇺🇸 원문 (English)
The WNC-M14A2A LTE-M modem driver mishandles unsolicited %NOTIFYEV: events in on_cmd_socknotifyev() (drivers/modem/vendor_standalone/wncm14a2a.c). The response line is linearized into a fixed 40-byte stack buffer via net_buf_linearize(), which caps the copy at 39 bytes and returns out_len <= 39. The two quote-delimiter scanning loops, however, were bounded by len — the full CR/LF-delimited frame length returned by net_buf_findcrlf() — rather than by out_len.
When a %NOTIFYEV: line longer than 39 bytes contains no " within the linearized region, the loop indices p1/p2 walk past value[39] and read adjacent stack memory until a stray quote byte is found or the index reaches len. The over-read string is then passed to strncmp()/atoi()/LOG_*, and if a quote byte is found out of bounds the subsequent value[p2] = '\0' performs a single-NUL out-of-bounds stack write at an attacker-influenced offset.
The %NOTIFYEV: payload carries network-derived content (LTIME network time, SIB1 base-station system information, CSPS/RRCSTATE), so a rogue cellular base station, a malicious or compromised modem module, or RF manipulation that induces an over-long notify line reaches the defect without any application interaction; the handler runs automatically on the unsolicited event in the modem RX thread.
The impact is out-of-bounds stack disclosure (into logs and parsing) and stack corruption that can crash the modem RX thread (denial of service). The write offset is only weakly controlled, so memory-safe code execution is not demonstrated. The fix bounds both scanning loops by out_len, keeping all accesses within the linearized buffer.
📍 영향받는 시스템
WNC-M14A2A LTE-M 모뎀 드라이버(drivers/modem/vendor_standalone/wncm14a2a.c)를 사용하는 Zephyr 기반 펌웨어 빌드
⚔️ 공격 벡터
악성 또는 위조된 LTE 기지국/RF 조작으로 39바이트를 초과하는 %NOTIFYEV: 줄을 전송해 자동 처리 경로에서 범위 외 읽기/쓰기를 유발
🛡️ 대응 방법
on_cmd_socknotifyev()의 두 따옴표 스캔 루프 경계를 len 대신 out_len으로 제한하는 패치를 적용하고 펌웨어를 업데이트
🔧 검증 코드
스캔 루프 조건이 len이 아닌 out_len으로 제한되어 있으면 패치가 적용된 것이며, 결과가 없거나 여전히 len을 사용하면 취약한 상태입니다.
grep -n "out_len" drivers/modem/vendor_standalone/wncm14a2a.c | grep -E "p1|p2"