[riot-notifications] [RIOT-OS/RIOT] Memory read beyond input buffer boundaries in nanocoap packet parser (#14074)
notifications at github.com
Wed May 13 23:47:52 CEST 2020
The current packet parsing pointer is incremented by the token length provided in the packet header without checking if the resulting pointer is still in the valid input buffer boundaries:
Additionaly, the coap_get_token_len() function allows for reserved values (>8) up to 15 to be returned without indicating an invalid packet.
The incremented pkt_pos pointer is further processed by the options parsing loop. If the pointer has skipped over the input buffer end, the loop will be entered and an invalid address read access may be made due to incorrect loop condition:
#### Steps to reproduce the issue
Provide an input packet with token length longer than the following packet length.
#### Expected results
An error code returned by the parsing function if a malformed packet is encountered. No access to memory areas out of the input buffer boundaries should be made.
#### Actual results
Read of memory outside the input boundaries. The parser continues processing beyond the provided input buffer.
Depending on memory allocation method and memory protection means it may result in crash or data processing beyond the input packet buffer.
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the notifications