🔍 CVE-2026-18747

6.8
CVSS Score
MEDIUM
2026-09-29
2026-09-30 14:17
✅ 완료

🇰🇷 한글 설명

MCUmgr SMP-over-console 전송 계층에서 패킷 길이를 처리할 때 정수 언더플로우가 발생하여 버퍼 크기를 초과하는 메모리 접근이 가능해지는 취약점입니다. 공격자는 조작된 Base64 프레임을 전송하여 메모리 외부의 데이터를 읽거나 시스템을 중단시키는 서비스 거부(DoS) 공격을 수행할 수 있습니다.

💡 쉬운 설명

관리용 콘솔에 특수한 짧은 메시지를 보내면 시스템이 데이터 길이를 잘못 계산하여 메모리의 엉뚱한 부분을 읽게 됩니다. 이로 인해 시스템이 멈추거나 중요한 정보가 유출될 위험이 있습니다.

🇺🇸 원문 (English)

The MCUmgr SMP-over-console transport decodes a base64 frame, reads a 16-bit packet length from it, verifies a CRC and then unconditionally strips the trailing CRC with rx_ctxt->nb->len -= 2U; in mcumgr_serial_process_frag() (subsys/mgmt/mcumgr/transport/src/serial_util.c). mcumgr_serial_extract_len() accepted any declared length, including 0 and 1, and a packet declaring length 0 passes the checksum test for free because crc16_itu_t() over zero bytes returns the zero seed. Since net_buf::len is a uint16_t, the subtraction underflows and the buffer is handed to SMP claiming roughly 65 KB of payload while its data area is only CONFIG_MCUMGR_TRANSPORT_NETBUF_SIZE bytes (default 384). The trigger is a single unauthenticated 7-byte line on the management console — the 0x06 0x09 packet marker followed by the base64 group AAA= and a newline — delivered to any transport built on this helper: CONFIG_MCUMGR_TRANSPORT_UART (smp_uart.c) or CONFIG_MCUMGR_TRANSPORT_SHELL (smp_shell.c), both of which select MCUMGR_TRANSPORT_SERIAL_HAS_SMP_OVER_CONSOLE. No prior session state, fragmentation or credentials are required to trigger the underflow, and the malformed frame is mishandled before any command handler or command-level access control runs. The attacker only needs write access to that console, which on many boards is a USB CDC-ACM port rather than a bare UART header. With the inflated length, smp_process_request_packet() in subsys/mgmt/mcumgr/smp/src/smp.c loses its bound: cbor_nb_reader_init() gives the CBOR decoder a ~65 KB window into a 384-byte buffer, and each request header's nh_len is checked only against the inflated length. On its own the 7-byte frame re-parses whatever stale bytes the reused pool buffer still holds, typically a replay of the previously received request followed by a parse error, without leaving the buffer. Because the transport is unauthenticated, though, the attacker also controls the frames sent before the trigger, and can stage buffer contents so that a request succeeds with an nh_len larger than the buffer; net_buf_pull(), guarded only by __ASSERT_NO_MSG, then moves the parse cursor out of bounds and the loop reads further headers and CBOR from adjacent memory. The consequence is an out-of-bounds read that can fault the MCUmgr thread (denial of service); memory disclosure is also possible, since the default-enabled os echo handler (CONFIG_MCUMGR_GRP_OS_ECHO) decodes its string inside that window and copies it into its response. There is no integrity gain beyond what the unauthenticated transport already permits. The fix rejects any declared packet length of two bytes or fewer in mcumgr_serial_extract_len(), so the CRC-strip subtraction can no longer underflow. The identical pattern remains in the test-only loopback transport subsys/mgmt/mcumgr/transport/src/smp_dummy.c (CONFIG_MCUMGR_TRANSPORT_DUMMY), which has no external input path and therefore carries no practical exposure.

📍 영향받는 시스템

MCUmgr SMP-over-console 전송 계층을 사용하는 시스템 (CONFIG_MCUMGR_TRANSPORT_UART 또는 CONFIG_MCUMGR_TRANSPORT_SHELL 활성화 시)

⚔️ 공격 벡터

인증되지 않은 상태에서 관리 콘솔(예: USB CDC-ACM 포트)을 통해 조작된 7바이트 Base64 프레임 전송

🛡️ 대응 방법

mcumgr_serial_extract_len() 함수에서 2바이트 이하의 패킷 길이를 거부하도록 패치 적용

🔧 검증 코드

패치된 코드에서 패킷 길이를 검증하여 2바이트 이하를 거부하는 로직이 포함되어 있는지 확인합니다.

Shell / Script
grep -r "mcumgr_serial_extract_len" subsys/mgmt/mcumgr/transport/src/serial_util.c

📊 CVSS Vector String

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

💻 영향받는 소프트웨어

Cloud Management Console