🇰🇷 한글 설명
LoRaWAN 애플리케이션 계층의 시계 동기화 서비스에서 다운링크 패킷을 처리할 때 버퍼 길이를 검증하지 않는 취약점이 발견되었습니다. 공격자가 조작된 AppTimeAns 명령을 보내면 수신 버퍼의 범위를 벗어난 데이터를 읽게 되어 장치의 시간 오프셋에 잘못된 값이 적용될 수 있습니다.
💡 쉬운 설명
기기가 시간을 맞추기 위해 받는 메시지가 너무 짧을 경우, 기기가 정해진 범위를 넘어서 데이터를 읽으려 시도하는 문제입니다. 이로 인해 기기의 시간이 아주 미세하게 틀려질 수 있지만, 정보 유출이나 시스템 중단 같은 큰 피해는 발생하지 않습니다.
🇺🇸 원문 (English)
The LoRaWAN application-layer clock-synchronization service parses downlinks in clock_sync_package_callback() (subsys/lorawan/services/clock_sync.c). Its command loop only guarantees that the one-byte command id is in bounds; for the CLOCK_SYNC_CMD_APP_TIME (AppTimeAns) command the handler then reads a 4-byte time correction via sys_get_le32() plus a 1-byte token without checking that 5 bytes remain in the receive buffer (len - rx_pos). A short or crafted AppTimeAns therefore reads up to 5 bytes past the end of the decrypted payload.
The payload (rx_buf/len) is the decrypted application frame delivered to the registered downlink callback (mcps_indication->Buffer/BufferSize). Reaching the handler requires a frame on the clock-sync port that passes LoRaWAN's MAC integrity check and FRMPayload decryption, so the practical attacker is a malicious or compromised network/application server (the designated sender of AppTimeAns) or a party holding the session keys, rather than an arbitrary radio listener.
The over-read is bounded: the backing store is a fixed 255-byte static buffer, so the few stray bytes do not fault, and the read values (time_correction, token) are used only internally and never transmitted, so there is no disclosure to the attacker and no crash. The sole effect is that a stale token matching ctx.req_token can apply a garbage time_correction to the device's own clock offset (ctx.time_offset), a minor integrity impact confined to the victim's time estimate. The fix adds an explicit length check that drops a too-short AppTimeAns. Note the sibling one-byte reads in the periodicity and force-resync handlers remain unguarded with the same negligible impact.
📍 영향받는 시스템
LoRaWAN clock-synchronization service (subsys/lorawan/services/clock_sync.c)
⚔️ 공격 벡터
세션 키를 보유한 악의적인 네트워크 서버 또는 애플리케이션 서버를 통한 조작된 AppTimeAns 패킷 전송
🛡️ 대응 방법
AppTimeAns 명령 처리 시 수신 버퍼의 남은 길이를 확인하는 길이 검증 로직을 추가하여 패치 적용
🔧 검증 코드
소스 코드 내 해당 함수에서 AppTimeAns 처리 시 len - rx_pos를 통한 길이 검증 로직이 포함되어 있는지 확인
grep -r "clock_sync_package_callback" subsys/lorawan/services/clock_sync.c
📊 CVSS Vector String
CVSS:3.1/AV:A/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N
💻 영향받는 소프트웨어
IBM WebSphere Application Server