CVE-2020-12887
What it is
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.
At a glance
- Exploitability
- Can be exploited over the network without logging in. High risk of service disruption.
- Exploit odds
- 1.7% chance of exploitation in the next 30 days (EPSS).
- Fix
- A patch, advisory or fixed version is referenced. Upgrade or apply it.
Timeline
- PublishedDisclosed publicly on CVE.org and NVD
- Last updatedMost recent change to the record
Why it ranks here
- Exploited in the wild: no, CISA does not list it.
- Exploit odds: 1.7% in the next 30 days (EPSS).
- Severity: 7.5 HIGH (CVSS).
- Fix: a patch or advisory is linked.
Details
- Published
- Last modified
- Exploit probability
- 1.7% · EPSS, next 30 days
- Weakness
- CWE-190 · Integer overflow
- Record status
- Modified
Affected
- Arm mbed-coap 5.1.5
Attack profile CVSS 3.1 · 7.5
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- None
- Scope
- Unchanged
- Confidentiality
- None
- Integrity
- None
- Availability
- High
Raw vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Is it in your code?
Hand this to your coding agent. It searches your project for the affected products and checks versions. Nothing leaves your machine.
Read https://cve-list.com/agent/cve/CVE-2020-12887.md and follow it. Check whether this project is affected by CVE-2020-12887. Read only. Don't change anything and don't upload my code. Tell me yes, no or not sure, with the file as proof.
Fix and advisories
- https://github.com/ARMmbed/mbed-coap/pull/116
- https://github.com/mjurczak/mbed-coap/commit/4647a68e364401e81dbd370728127d844f221d93
- https://github.com/ARMmbed/mbed-coap/pull/116
- https://github.com/mjurczak/mbed-coap/commit/4647a68e364401e81dbd370728127d844f221d93
References
- https://github.com/ARMmbed/mbed-coap/pull/116
- https://github.com/ARMmbed/mbed-os/issues/12930
- https://github.com/ARMmbed/mbed-os/issues/12957
- https://github.com/mjurczak/mbed-coap/commit/4647a68e364401e81dbd370728127d844f221d93
- https://github.com/ARMmbed/mbed-coap/pull/116
- https://github.com/ARMmbed/mbed-os/issues/12930
- https://github.com/ARMmbed/mbed-os/issues/12957
- https://github.com/mjurczak/mbed-coap/commit/4647a68e364401e81dbd370728127d844f221d93