🇰🇷 한글 설명
Linux 커널의 IPv6 RPL 구현 중 ipv6_rpl_srh_decompress() 함수에서 hdrlen 변수의 오버플로우 취약점이 발견되었습니다. n이 127 이상일 경우 계산된 헤더 길이가 8비트 변수 범위를 초과하여 데이터가 잘리게 되며, 이로 인해 압축된 헤더가 압축 해제된 데이터 영역과 겹쳐 데이터가 손상될 수 있습니다.
💡 쉬운 설명
네트워크 데이터의 길이를 계산하는 과정에서 숫자가 너무 커져서 실제 크기보다 훨씬 작게 인식되는 오류가 발생합니다. 이로 인해 데이터가 서로 엉키게 되어 네트워크 패킷이 망가지거나 시스템에 문제를 일으킬 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
ipv6: rpl: fix hdrlen overflow in ipv6_rpl_srh_decompress()
ipv6_rpl_srh_decompress() computes:
outhdr->hdrlen = (((n + 1) * sizeof(struct in6_addr)) >> 3);
hdrlen is __u8. For n >= 127 the result exceeds 255 and silently
truncates. With n=127 (cmpri=15, cmpre=15, pad=0, hdrlen=16):
(128 * 16) >> 3 = 256, truncated to 0 as __u8
The caller in ipv6_rpl_srh_rcv() then places the compressed header
at buf + ((ohdr->hdrlen + 1) << 3). With hdrlen=0 this is buf + 8,
but the decompressed region occupies buf[0..2055] (8-byte header
plus 128 full addresses). The compressed header overlaps the
decompressed data, and ipv6_rpl_srh_compress() writes into this
overlap, corrupting the routing header of the forwarded packet.
The existing guard at exthdrs.c:546 checks (n + 1) > 255, which
prevents n+1 from overflowing unsigned char (the segments_left
field), but does not prevent the computed hdrlen from overflowing
__u8. n=127 passes because 128 <= 255, yet hdrlen=256 does not
fit.
Tighten the bound to (n + 1) > 127. This caps n at 126, giving
hdrlen = (127 * 16) >> 3 = 254, which fits in __u8. The compressed
header then lands at buf + ((254 + 1) << 3) = buf + 2040, exactly
past the decompressed region (buf[0..2039]). No overlap. 127
segments is well beyond any realistic RPL deployment.
📍 영향받는 시스템
IPv6 RPL 기능을 사용하는 Linux 커널 버전
⚔️ 공격 벡터
조작된 IPv6 RPL 확장 헤더를 포함한 패킷을 전송하여 메모리 영역 중첩 및 데이터 오염 유도
🛡️ 대응 방법
커널 패치를 통해 n의 범위를 126 이하로 제한하여 hdrlen 오버플로우 방지
🔧 검증 코드
현재 실행 중인 커널 버전을 확인하여 해당 취약점이 수정된 최신 보안 패치 버전인지 확인합니다.