Arm · Arm Mbed-Coap Library · CVE-2020-12887
**Name of the Vulnerable Software and Affected Versions**
Arm Mbed OS version 5.15.3
Arm mbed-coap library version 5.1.5
**Description**
A memory leak issue was discovered in the CoAP library of Arm Mbed OS when using the Arm mbed-coap library. The CoAP parser, specifically the function `sn coap parser options parse()`, is responsible for parsing received CoAP packets. Due to a lack of overflow detection, it is possible to craft a packet that wraps the option number around, resulting in the same option number being processed again in a single packet. Certain options, such as `COAP OPTION URI QUERY`, `COAP OPTION URI PATH`, `COAP OPTION LOCATION QUERY`, and `COAP OPTION ETAG`, allocate memory without checking if it has already been allocated, leading to multiple assignments of allocated memory to a single pointer and resulting in a memory leak by buffer orphaning.
**Recommendations**
For Arm Mbed OS version 5.15.3, consider disabling the `sn coap parser options parse()` function until a patch is available.
For Arm mbed-coap library version 5.1.5, restrict access to the CoAP parser to minimize the risk of exploitation.
Avoid using the affected options, such as `COAP OPTION URI QUERY`, `COAP OPTION URI PATH`, `COAP OPTION LOCATION QUERY`, and `COAP OPTION ETAG`, in the CoAP packets until the issue is resolved.
At the moment, there is no information about a newer version that contains a fix for this vulnerability.