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.
"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2020-12887.json"
[
{
"deprecated": false,
"digest": {
"line_hashes": [
"43935030550028460972366703954953134506",
"61220096632304049730327333197098972093",
"320150627691496278385405560211966556678",
"186675183860793561524494747944059615369",
"127642696780443805742401594398900435540",
"267445146679481831720080028433391405271",
"132521230294210119945172885974631191107",
"324396917462271122704704442064617277709",
"234437120531583315022205507252856318308",
"286329828605066593614177102719712564752",
"87207223341953997356487330374609977771",
"104328434877095684334150716685446685855",
"11868571050448402586959641459417779210",
"303778255609881218744778712752022328171",
"133750296877345554551232479333421315007",
"67880556997018554008829165577206203797",
"92692987032122039680749309224731996056",
"140265851728056666005343675172730879491",
"63562575080231242002488574039690694253",
"189674393307302091111541820177517511947",
"321512261925602967327881274626398541763",
"232832846557700938117508429755115702658",
"264196848848161220298469949354019076766",
"321580769388070556555594160029624143808",
"151078017193110762447939574449023157217",
"310827814389590228290459433936542736136",
"256787609847999624942930714634370299162",
"242022160026061777274533866925894108323",
"62689593716048945512935592775715083022",
"95333874303436617107207441015869479329",
"112609262465420033381301208320792639619",
"317777804957382674265651800069815716158",
"199703098306503844081080891371244903433",
"302537996041334409574073001132100991715",
"305499100664098600512923207251055579036"
],
"threshold": 0.9
},
"id": "CVE-2020-12887-29fdbcad",
"signature_type": "Line",
"signature_version": "v1",
"source": "https://github.com/mjurczak/mbed-coap/commit/4647a68e364401e81dbd370728127d844f221d93",
"target": {
"file": "source/sn_coap_parser.c"
}
},
{
"deprecated": false,
"digest": {
"function_hash": "308725957387540955480929850339236134260",
"length": 7512
},
"id": "CVE-2020-12887-5a783e29",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://github.com/mjurczak/mbed-coap/commit/4647a68e364401e81dbd370728127d844f221d93",
"target": {
"file": "source/sn_coap_parser.c",
"function": "sn_coap_parser_options_parse"
}
},
{
"deprecated": false,
"digest": {
"function_hash": "245798078326036843653460174088154310762",
"length": 815
},
"id": "CVE-2020-12887-aa632ee5",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://github.com/mjurczak/mbed-coap/commit/4647a68e364401e81dbd370728127d844f221d93",
"target": {
"file": "source/sn_coap_parser.c",
"function": "parse_ext_option"
}
}
]
"2026-08-27T08:40:04Z"