Bug 2275803 (CVE-2024-31031) - CVE-2024-31031 libcoap: unsigned integer overflow vulnerability in coap_pdu.c
Summary: CVE-2024-31031 libcoap: unsigned integer overflow vulnerability in coap_pdu.c
Keywords:
Status: NEW
Alias: CVE-2024-31031
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 2275804
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-04-17 21:16 UTC by Robb Gatica
Modified: 2024-04-17 21:16 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Embargoed:


Attachments (Terms of Use)

Description Robb Gatica 2024-04-17 21:16:16 UTC
An issue in `coap_pdu.c` in libcoap 4.3.4 allows attackers to cause undefined behavior via a sequence of messages leading to unsigned integer overflow.

Description:
After sending a sequence of messages to the CoAP server, a runtime error was reported by UndefinedBehaviorSanitizer (UBSan). The error indicated an unsigned integer overflow occurred in coap_pdu.c at the line where an address calculation was being performed. Specifically, an unsigned offset addition to a base address resulted in an overflow, indicating that the calculated address wrapped around to a lower value than the original address. This is a sign of undefined behavior due to integer overflow during pointer arithmetic. This suggests that the resulting address calculation wrapped around, which is indicative of undefined behavior in the program.

Expected Behavior:
The server is expected to handle a sequence of incoming messages reliably without encountering arithmetic overflows or other undefined behaviors during address calculations. Memory operations should remain within their allocated bounds, and all pointer arithmetic should result in valid memory addresses that are within the expected range.

Actual Behavior:
The server exhibited undefined behavior after processing a sequence of messages, indicating a potential flaw in the address calculation within the coap_update_token function.

References:
https://github.com/obgm/libcoap/issues/1351

Comment 1 Robb Gatica 2024-04-17 21:16:28 UTC
Created libcoap tracking bugs for this issue:

Affects: fedora-all [bug 2275804]


Note You need to log in before you can comment on or make changes to this bug.