Skip to content

Latest commit

 

History

History
20 lines (15 loc) · 1.11 KB

File metadata and controls

20 lines (15 loc) · 1.11 KB

Integer Underflow during defragmentation

Summary

Integer underflow in _6lo_frag_size.

Location

sys/net/gnrc/network_layer/sixlowpan/frag/rb/gnrc_sixlowpan_frag_rb.c:234

Description

In _6lo_frag_size the fragment size is calculated as frag_size = pkt->size - sizeof(sixlowpan_frag_n_t); source. sizeof(sixlowpan_frag_n_t) is 4 bytes but pkt->size can be less resulting in an integer underflow. _rbuf_add later uses this value as size argument for memcpy source.

Impact

  • A large OOB memcpy is started in the packet buffer, resulting in a crash once the end of memory is reached
  • A manipulated packet can lead to DoS
  • Based on timing (context switch during memcpy operation) and board RAM (>64kB of RAM), corruption might be exploitable to RCE

Potential fix

Check that fragmented packets are at least sizeof(sixlowpan_frag_n_t) bytes large.