Integer overflow in Arm Mbed-Coap
CVE-2020-12887
Memory leaks were discovered in the CoAP library in Arm Mbed OS 5.15.3 when using the Arm mbed-coap library 5.1.5. The CoAP parser is responsible for parsing received CoAP packets. The function sn_coap_parser_options_parse() parses the CoAP option number field of all options present in the input packet. Each option number is calculated as a sum of the previous option number and a delta of the current option. The delta and the previous option number are expressed as unsigned 16-bit integers. Due to lack of overflow detection, it is possible to craft a packet that wraps the option number around and results in the same option number being processed again in a single packet. Certain options allocate memory by calling a memory allocation function. In the cases of COAP_OPTION_URI_QUERY, COAP_OPTION_URI_PATH, COAP_OPTION_LOCATION_QUERY, and COAP_OPTION_ETAG, there is no check on whether memory has already been allocated, which in conjunction with the option number integer overflow may lead to multiple assignments of allocated memory to a single pointer. This has been demonstrated to lead to memory leak by buffer orphaning. As a result, the memory is never freed.
Vulnerability class: Integer Overflow
Published · last modified .
CVSS v3 metric
CVSS v3 base score 7.5 (High). Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
EPSS exploit prediction
EPSS: 0.017 (76.7th percentile), scored .
Low probability of exploitation in the next 30 days, but still tracked. 77th percentile — 76.7% of CVEs in the catalogue have a lower EPSS than this one. How to read EPSS.
EPSS over last 30 days · oldest: 0.017 · newest: 0.017 · change: 0.000
Affected products
- Arm Mbed-Coap — versions 5.1.5
- Arm Mbed OS — versions 5.15.3
Weakness classification (CWE)
References
- github.com/ARMmbed/mbed-os/issues/12957 (Third Party Advisory)
- github.com/ARMmbed/mbed-os/issues/12930 (Third Party Advisory)
- github.com/mjurczak/mbed-coap/commit/4647a68e364401e81dbd370728127d844f221d93 (Patch, Third Party Advisory)
- github.com/ARMmbed/mbed-coap/pull/116 (Third Party Advisory)
Frequently asked questions
- What is CVE-2020-12887?
- CVE-2020-12887 is a high-severity vulnerability in Arm Mbed-Coap, classified under Integer Overflow or Wraparound. CVSS score: 7.5/10. Published 2020-06-18.
- How severe is CVE-2020-12887?
- High severity. CVSS v3 base score is 7.5 out of 10.