{"id":"CVE-2021-21401","published":"2021-03-23T17:45:19Z","modified":"2024-08-03T18:09:16Z","title":"Invalid free() call in Nanopb","vendor":"nanopb","product":"nanopb","tier":"tail","description":{"text":"Nanopb is a small code-size Protocol Buffers implementation in ansi C. In Nanopb before versions 0.3.9.8 and 0.4.5, decoding a specifically formed message can cause invalid `free()` or `realloc()` calls if the message type contains an `oneof` field, and the `oneof` directly contains both a pointer field and a non-pointer field. If the message data first contains the non-pointer field and then the pointer field, the data of the non-pointer field is incorrectly treated as if it was a pointer value. Such message data rarely occurs in normal messages, but it is a concern when untrusted data is parsed. This has been fixed in versions 0.3.9.8 and 0.4.5. See referenced GitHub Security Advisory for more information including workarounds.","provenance":"source","from":"CVE.org"},"cvss":{"score":7.1,"severity":"HIGH","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:L","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.01811,"percentile":0.79093,"provenance":"source"},"cwes":[{"id":"CWE-763","name":"Release of Invalid Pointer or Reference"}],"references":[{"url":"https://github.com/nanopb/nanopb/security/advisories/GHSA-7mv5-5mxh-qg88","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/nanopb/nanopb/issues/647","tags":["x_refsource_MISC"]},{"url":"https://github.com/nanopb/nanopb/commit/e2f0ccf939d9f82931d085acb6df8e9a182a4261","tags":["x_refsource_MISC"]},{"url":"https://github.com/nanopb/nanopb/blob/c9124132a604047d0ef97a09c0e99cd9bed2c818/CHANGELOG.txt#L1","tags":["x_refsource_MISC"]}],"priority":{"score":20.8,"factors":[{"name":"EPSS percentile","points":15.82},{"name":"CVSS severity","points":4.97}]},"vendorSlug":"nanopb","affectedVersions":[{"vendor":"nanopb","product":"nanopb","versions":[">= 0.3.2, <= 0.3.9.7",">= 0.4.0, <= 0.4.4"]}],"affected":[{"ecosystem":"PyPI","package":"nanopb","vulnerableRanges":[">=0.3.2, <0.3.9.8",">=0.4.0, <0.4.5","<0.3.9.8"],"patched":["0.3.9.8","0.4.5"],"from":["GHSA-7mv5-5mxh-qg88","PYSEC-2021-432"],"provenance":"source"}],"euvd":{"id":"EUVD-2021-0139","exploited":false,"provenance":"source"},"lineage":{"packageHistory":[{"cve":"CVE-2020-26243","published":"2020-11-25","fixed":"0.4.4","kev":false,"link":{"from":"CVE-2020-26243","to":"CVE-2021-21401","relation":"successor","confidence":"high","kind":"sequence","evidence":[{"kind":"version-step","provenance":"source","package":"PyPI:nanopb","fromFixed":"0.3.9.7","toFixed":"0.3.9.8","daysApart":118},{"kind":"version-step","provenance":"source","package":"PyPI:nanopb","fromFixed":"0.4.4","toFixed":"0.4.5","daysApart":118},{"kind":"same-code","provenance":"machine","files":["pb_decode.c"],"commits":["https://github.com/nanopb/nanopb/commit/4fe23595732b6f1254cfc11a9b8d6da900b55b0c","https://github.com/nanopb/nanopb/commit/e2f0ccf939d9f82931d085acb6df8e9a182a4261","https://github.com/nanopb/nanopb/commit/4a375a560651a86726e5283be85a9231fd0efe9c"],"basis":"shared file"}]}},{"cve":"CVE-2021-21401","published":"2021-03-23","fixed":"0.4.5","kev":false}],"package":"PyPI:nanopb"}}