Read the docs
TI-2021-04499 Aliases CVE-2021-21401GHSA-7mv5-5mxh-qg88

Invalid free() call in Nanopb

Priority LOW 35CWE-763Published · Updated

Key facts

Attack vector
Network
Privileges required
Low
User interaction
None
Attack complexity
Low
Impact type
—
Confidentiality · integrity · availability
None · High · Low
Fix status
Fixed

Attack profile from CVSS 3.1 · CNA. Fix status from CNA and GitHub.

Summary

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.

Why it matters now

EPSS 0.01811 78th percentileScored 2026-11-07
Public exploit Yes 2 exploit referencesTagged by NVD
Fix Fixed nanopb (PyPI): 0.3.9.8, 0.4.5

SSVC decision points

Not available: CISA has not published SSVC decision points for this record.

Affected products

VendorProductAffected versionsFixed inStatusSource
nanopbnanopb0.3.2 – 0.3.9.7; 0.4.0 – 0.4.4—No fix listedCNA
—nanopb (PyPI)0.3.2 to before 0.3.9.80.3.9.8Patch availableGHSA-7mv5-5mxh-qg88
—nanopb (PyPI)0.4.0 to before 0.4.50.4.5Patch availableGHSA-7mv5-5mxh-qg88
  • nanopb Vendornanopb Affected 0.3.2 – 0.3.9.7; 0.4.0 – 0.4.4 Fixed in — No fix listed CNA
  • nanopb (PyPI) Vendor— Affected 0.3.2 to before 0.3.9.8 Fixed in 0.3.9.8 Patch available GHSA-7mv5-5mxh-qg88
  • nanopb (PyPI) Vendor— Affected 0.4.0 to before 0.4.5 Fixed in 0.4.5 Patch available GHSA-7mv5-5mxh-qg88

CPE configurations NVD · 1

CPEVersionsRoleVendor
cpe:2.3:a:nanopb_project:nanopb:*:*:*:*:*:*:*:*before 0.3.9.8; 0.4.0 to before 0.4.5Vulnerablenanopb
  • cpe:2.3:a:nanopb_project:nanopb:*:*:*:*:*:*:*:* Versions before 0.3.9.8; 0.4.0 to before 0.4.5 Vulnerable ·nanopb

Remediation

  • Fix · GHSA-7mv5-5mxh-qg88 nanopb (PyPI) Fixed in 0.3.9.8 Advisory →
  • Fix · GHSA-7mv5-5mxh-qg88 nanopb (PyPI) Fixed in 0.4.5 Advisory →

Timeline

  1. 2026-10-02 Threatist record created from CVE-2021-21401
  2. 2026-10-03 Alias added: GHSA-7mv5-5mxh-qg88

References

  • TI-2014-08406 Nanopb before 0.3.1 allows size_t overflows in pb_dec_bytes and pb_dec_string. CVSS 3.1CRITICAL 9.8
  • TI-2020-04291 Out-of-memory condition in Nanopb is potentially exploitable CVSS 3.1CRITICAL 9.8
  • TI-2020-16064 Memory leak in nanopb CVSS 3.1HIGH 7.5

Sources