Home / nanopb / nanopb / CVE-2021-21401
CVE-2021-21401: is it exploited, and which versions of nanopb are affected and fixed?
CVE-2021-21401 is a release of invalid pointer vulnerability in nanopb. It is not known to be exploited: it is not in CISA's Known Exploited Vulnerabilities catalog (catalog 2026.11.30, read December 3, 2026, 16:39 UTC). Affected: nanopb from 0.3.2 before 0.3.9.8 and nanopb from 0.4.0 before 0.4.5 (GitHub advisory GHSA-7mv5-5mxh-qg88). Fixed in 0.3.9.8 and 0.4.5 (GitHub advisory GHSA-7mv5-5mxh-qg88). Severity: High (7.1, CVSS 3.1, from GitHub_M).
Data checked December 3, 2026: last read CISA KEV December 3, 2026, 16:39 UTC, CVE record November 19, 2026, 07:15 UTC and NVD November 19, 2026, 07:59 UTC.
What is CVE-2021-21401?
Invalid free() call in Nanopb
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.
From the CVE record by GitHub_M, last updated August 3, 2024, 18:09 UTC.
Which versions are affected, and which fix it?
| Vendor | Product | Affected | Fixed or not affected from |
|---|---|---|---|
| nanopb | nanopb | >= 0.3.2, <= 0.3.9.7 >= 0.4.0, <= 0.4.4 |
As the CVE record by GitHub_M states it, last updated August 3, 2024. Version ranges are the CNA's; a version the record calls not affected is usually the fix.
Which packages are affected, and in which version is each fixed?
| Ecosystem | Package | Affected | Fixed in | Advisory |
|---|---|---|---|---|
| PyPI | nanopb | >= 0.3.2, < 0.3.9.8 | 0.3.9.8 | GHSA-7mv5-5mxh-qg88 |
| PyPI | nanopb | >= 0.4.0, < 0.4.5 | 0.4.5 | GHSA-7mv5-5mxh-qg88 |
GitHub Advisory Database, reviewed advisories (CC BY 4.0); advisory updated August 30, 2024. Summary: nanopb vulnerable to invalid free() call with oneofs and PB_ENABLE_MALLOC.
Which products and versions does the NVD list as affected?
| Vendor | Product | Versions | Type |
|---|---|---|---|
| nanopb project | nanopb | before 0.3.9.8 | application |
| nanopb project | nanopb | from 0.4.0 before 0.4.5 | application |
NVD analysis (status Modified), last modified June 17, 2026, 03:35 UTC.
How severe is CVE-2021-21401?
| Score | Version | Vector | Source |
|---|---|---|---|
| High 7.1 | CVSS 3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:L | GitHub_M |
| High 7.1 | CVSS 3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:L | NVD |
| Medium 5.5 | CVSS 2.0 | AV:N/AC:L/Au:S/C:N/I:P/A:P | NVD |
Each score is shown as its source gave it: the CNA that wrote the record, CISA's ADP (vulnrichment) and the NVD. They can differ.
What the ratings mean: in CVSS 3 and 4, scores run from 0 to 10, with Low 0.1 to 3.9, Medium 4.0 to 6.9, High 7.0 to 8.9 and Critical 9.0 to 10.0. CVSS 2 has no Critical band: its High runs from 7.0 to 10.0. The vector lists how the flaw is reached (network, local), what an attacker needs (privileges, a user's click) and what it can harm.
Is CVE-2021-21401 exploited in the wild?
- CISA KEV
- Not listed (catalog 2026.11.30)
- EPSS
- 1.81% probability of exploitation activity in the next 30 days, percentile 79.4 (FIRST EPSS, scores of December 3, 2026)
What kind of flaw is it?
- CWE-763 Release of Invalid Pointer or Reference
Where are the vendor advisories and references?
- https://github.com/nanopb/nanopb/security/advisories/GHSA-7mv5-5mxh-qg88 x_refsource_CONFIRM
- https://github.com/nanopb/nanopb/issues/647 x_refsource_MISC
- https://github.com/nanopb/nanopb/commit/e2f0ccf939d9f82931d085acb6df8e9a182a4261 x_refsource_MISC
- https://github.com/nanopb/nanopb/blob/c9124132a604047d0ef97a09c0e99cd9bed2c818/CHANGELOG.txt#L1 x_refsource_MISC
When was it published, and where is the official record?
- Reserved
- December 22, 2020
- Published
- March 23, 2021, 17:45 UTC
- CVE record updated
- August 3, 2024, 18:09 UTC by GitHub_M
- NVD
- Modified, last modified June 17, 2026, 03:35 UTC
- Last checked
- CVE list November 19, 2026, 07:15 UTC; NVD November 19, 2026, 07:59 UTC; KEV December 3, 2026, 16:39 UTC; EPSS December 3, 2026
- Official record
- cve.org · NVD
What other CVEs affect nanopb?
- Dec 2, 2024CVE-2024-53984 nanopb: memory leak
- Nov 25, 2020CVE-2020-26243 nanopb: improper input validation
- Feb 4, 2020CVE-2020-5235 Nanopb: out-of-bounds read
Questions about CVE-2021-21401
Is CVE-2021-21401 exploited in the wild?
Not as far as CISA knows: it is not in the Known Exploited Vulnerabilities catalog, read December 3, 2026, 16:39 UTC. FIRST's EPSS gives it a 1.81% chance of exploitation activity in the next 30 days (scores of December 3, 2026).
Which versions of nanopb are affected by CVE-2021-21401?
nanopb from 0.3.2 before 0.3.9.8 and nanopb from 0.4.0 before 0.4.5, per the GitHub advisory GHSA-7mv5-5mxh-qg88. The tables above give every range the sources list.
Which version fixes CVE-2021-21401?
0.3.9.8 and 0.4.5, per the GitHub advisory GHSA-7mv5-5mxh-qg88. Check the vendor's advisory before you rely on it.
How severe is CVE-2021-21401?
High (7.1, CVSS 3.1, from GitHub_M). The severity table above shows each score with its source.
Where is the official record of CVE-2021-21401?
The CVE Program's record is at cve.org and the NVD's at nvd.nist.gov. For a fix, the vendor's own advisory is the one to follow.