🇰🇷 한글 설명
LwM2M의 펌웨어 업데이트 과정에서 서버가 제공한 URI를 고정된 크기의 버퍼로 복사할 때 길이 검증을 수행하지 않아 발생하는 취약점입니다. 이로 인해 인접한 메모리를 초과하여 읽는 Out-of-bounds read가 발생하며, 이는 기기 정보 유출이나 서비스 거부(DoS)를 유발할 수 있습니다.
💡 쉬운 설명
기기가 업데이트 정보를 가져올 때, 입력된 주소의 길이를 확인하지 않고 메모리에 저장하여 문제가 발생합니다. 공격자가 조작된 주소를 보내면 기기의 중요한 내부 정보가 밖으로 새 나가거나 기기가 멈출 수 있습니다.
🇺🇸 원문 (English)
subsys/net/lib/lwm2m/lwm2m_pull_context.c copied the firmware-update Package URI into a fixed static buffer (context.uri, size CONFIG_LWM2M_SWMGMT_PACKAGE_URI_LEN, default 128) with memcpy(context.uri, uri, LWM2M_PACKAGE_URI_LEN), copying exactly the destination size with no length validation. The Firmware-Update object stores the server-supplied Package URI (/5/0/1) in a 255-byte buffer, so a LwM2M management server (or an on-path attacker on a session lacking strong DTLS) can WRITE a URI of 128-254 characters; only the first 128 bytes are then copied into context.uri with no NUL terminator. That buffer is subsequently consumed as a C string by http_parser_parse_url(context.uri, strlen(context.uri), ...), strlen-based CoAP URI-path/PROXY-URI option appends, and lwm2m_parse_peerinfo(), causing an out-of-bounds read of adjacent static memory. The over-read bytes are appended to outbound CoAP requests (information disclosure of adjacent device memory to the server/proxy) and can crash the device (denial of service). The vulnerable copy was introduced by the pull-context refactor (first released in v3.0.0) and is present through v4.4.0; the default-on CONFIG_LWM2M_FIRMWARE_UPDATE_PULL_SUPPORT path is affected. The fix adds a strlen(uri) >= sizeof(context.uri) check returning -ENOMEM and switches to strcpy(), guaranteeing a bounded, NUL-terminated buffer.
📍 영향받는 시스템
LwM2M v3.0.0 ~ v4.4.0 (CONFIG_LWM2M_FIRMWARE_UPDATE_PULL_SUPPORT 활성화 시)
⚔️ 공격 벡터
DTLS 보안이 약한 세션에서 관리 서버 또는 중간자 공격자(On-path attacker)가 조작된 URI를 전송
🛡️ 대응 방법
LwM2M 버전을 최신 패치 버전으로 업데이트하거나, URI 길이를 검증하는 로직이 적용된 코드로 수정
🔧 검증 코드
소스 코드 내 취약한 파일 존재 여부와 설정 파일에서 해당 기능이 활성화되어 있는지 확인합니다.
grep -r "lwm2m_pull_context.c" /path/to/source && grep -E "CONFIG_LWM2M_FIRMWARE_UPDATE_PULL_SUPPORT=y" .config
📊 CVSS Vector String
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:L
💻 영향받는 소프트웨어
Multi-Domain Security Management Server