# 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.

- Severity: High 7.5 (CVSS:3.1, scored by NVD) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 1.73%, higher than 78% of CVEs (2026-12-01)
- Published: 2020-06-18T18:24:47.000Z
- Modified: 2026-06-17T02:52:29.407Z
- Weaknesses: CWE-190, CWE-401
- Assigned by: mitre

## Description

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.

(As written by CVE List.)

## Affected

- Unspecified product: n/a
- arm mbed-coap: 5.1.5

## Every score

- NVD: CVSS:3.1 7.5 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
- NVD: CVSS:2.0 5.0 Medium `AV:N/AC:L/Au:N/C:N/I:N/A:P`

## References

- <https://github.com/ARMmbed/mbed-os/issues/12957> (third-party-advisory)
- <https://github.com/ARMmbed/mbed-os/issues/12930> (third-party-advisory)
- <https://github.com/mjurczak/mbed-coap/commit/4647a68e364401e81dbd370728127d844f221d93> (patch, third-party-advisory)
- <https://github.com/ARMmbed/mbed-coap/pull/116> (third-party-advisory)

## Sources

- CVE List: [CVE-2020-12887](https://www.cve.org/CVERecord?id=CVE-2020-12887), CVE Terms of Use, modified 2024-08-04
- NVD: [CVE-2020-12887](https://nvd.nist.gov/vuln/detail/CVE-2020-12887), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2020-12887 · Whole record: https://cve.day/CVE-2020-12887.json · Rebuilt by cve.day 2026-11-25T22:57:53.037Z
