{"cve":"CVE-2021-21401","nvd":{"published":"2021-03-23T18:15:13.160","modified":"2026-06-17T03:35:29.647","status":"Modified","description":"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.","cvss_v4":null,"cvss_v3":{"version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:L","score":7.1},"cwes":["CWE-763"],"references":["https://github.com/nanopb/nanopb/blob/c9124132a604047d0ef97a09c0e99cd9bed2c818/CHANGELOG.txt#L1","https://github.com/nanopb/nanopb/commit/e2f0ccf939d9f82931d085acb6df8e9a182a4261","https://github.com/nanopb/nanopb/issues/647","https://github.com/nanopb/nanopb/security/advisories/GHSA-7mv5-5mxh-qg88","https://github.com/nanopb/nanopb/blob/c9124132a604047d0ef97a09c0e99cd9bed2c818/CHANGELOG.txt#L1"],"products":["nanopb_project:nanopb"],"source":"nvd","synced_at":"2026-10-19T21:15:50.279857260+00:00"},"epss":{"cve":"CVE-2021-21401","score":0.01811,"percentile":0.78626,"date":"2026-10-31"},"kev":null,"osv":[{"id":"GHSA-7mv5-5mxh-qg88","url":"https://osv.dev/vulnerability/GHSA-7mv5-5mxh-qg88","summary":"nanopb vulnerable to invalid free() call with oneofs and PB_ENABLE_MALLOC","modified":"2026-07-08T06:28:07.042648156Z","packages":[{"ecosystem":"PyPI","name":"nanopb","purl":"pkg:pypi/nanopb","ranges":[">=0.3.2 <0.3.9.8"],"fixed":["0.3.9.8"]},{"ecosystem":"PyPI","name":"nanopb","purl":"pkg:pypi/nanopb","ranges":[">=0.4.0 <0.4.5"],"fixed":["0.4.5"]}]},{"id":"PYSEC-2021-432","url":"https://osv.dev/vulnerability/PYSEC-2021-432","summary":"","modified":"2023-11-08T04:04:44.596402Z","packages":[{"ecosystem":"PyPI","name":"nanopb","purl":"pkg:pypi/nanopb","ranges":["<0.3.9.8",">=0.4.0 <0.4.5"],"fixed":["0.3.9.8","0.4.5"]}]}],"attribution":["This product uses the NVD API but is not endorsed or certified by the NVD.","EPSS scores: FIRST Exploit Prediction Scoring System, https://www.first.org/epss","Known exploited vulnerabilities: CISA Known Exploited Vulnerabilities Catalog, https://www.cisa.gov/known-exploited-vulnerabilities-catalog","Package advisories: OSV (https://osv.dev), from the GitHub Advisory Database, PyPA, Go, RustSec and other ecosystem databases, under CC-BY 4.0 or CC0","CVE records: the CVE Program's CVE List (https://www.cve.org), under its terms of use (https://www.cve.org/Legal/TermsOfUse). CVE is a registered trademark of The MITRE Corporation; this product is not affiliated with the CVE Program."]}