Headline
CVE-2023-24821: gnrc_sixlowpan: Various hardening fixes [backport 2022.10] by miri64 · Pull Request #18820 · RIOT-OS/RIOT
RIOT-OS, an operating system that supports Internet of Things devices, contains a network stack with the ability to process 6LoWPAN frames. Prior to version 2022.10, an attacker can send a crafted frame to the device resulting in a large out of bounds write beyond the packet buffer. The write will create a hard fault exception after reaching the last page of RAM. The hard fault is not handled and the system will be stuck until reset, thus the impact is denial of service. Version 2022.10 fixes this issue. As a workaround, disable support for fragmented IP datagrams or apply the patches manually.
@@ -236,6 +236,9 @@ static size_t _6lo_frag_size(gnrc_pktsnip_t *pkt, size_t offset, uint8_t *data) size_t frag_size;
if (offset == 0) { if (pkt->size < sizeof(sixlowpan_frag_t)) { return 0; } frag_size = pkt->size - sizeof(sixlowpan_frag_t); if (data[0] == SIXLOWPAN_UNCOMP) { /* subtract SIXLOWPAN_UNCOMP byte from fragment size, @@ -244,6 +247,9 @@ static size_t _6lo_frag_size(gnrc_pktsnip_t *pkt, size_t offset, uint8_t *data) } } else { if (pkt->size < sizeof(sixlowpan_frag_n_t)) { return 0; } frag_size = pkt->size - sizeof(sixlowpan_frag_n_t); } return frag_size; @@ -306,6 +312,11 @@ static int _rbuf_add(gnrc_netif_hdr_t *netif_hdr, gnrc_pktsnip_t *pkt, if (IS_USED(MODULE_GNRC_SIXLOWPAN_FRAG) && sixlowpan_frag_is(pkt->data)) { data = _6lo_frag_payload(pkt); frag_size = _6lo_frag_size(pkt, offset, data); if (frag_size == 0) { DEBUG(“6lo rbuf: integer underflow detected.\n”); gnrc_pktbuf_release(pkt); return RBUF_ADD_ERROR; } datagram_size = sixlowpan_frag_datagram_size(pkt->data); datagram_tag = sixlowpan_frag_datagram_tag(pkt->data); }