CVE-2021-21401

Invalid free() call in Nanopb

HIGH
7.1
CVSS Score
Published: March 23, 2021 at 05:45 PM UTC
Updated: June 17, 2026 at 03:35 AM UTC
1 product affected across 1 vendorNanopb

Using nanopb by nanopb?

Get instant alerts when new vulnerabilities affect nanopb - before attackers find them.

Real-time alertsTrack your software stackFree plan available
Severity
HIGH7.1
Exploit prediction
EPSS 2%

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.

Affected

Our own answer: ranges merged, affected separated from platform-only, with confidence and review flags.

v ≤ 0.3.9.7v ≤ 0.4.4v < 0.3.9.80.4.0 ≤ v < 0.4.5
Affected range stops below 0.3.9.8, so it looks safe — our inference, not a vendor statement
Affected range stops below 0.4.5, so it looks safe — our inference, not a vendor statement

Remediation

No guide yet

No remediation guidance has been written for this CVE yet. What the record does show:

References (4)

CVSS

7.1HIGHGitHub_M
Attack Vector
NETWORK
Complexity
LOW
Privileges
LOW
User Interaction
NONE
Scope
UNCHANGED
Confidentiality
NONE
Integrity
HIGH
Availability
LOW
Vector?

Quick Info

StatusMODIFIED
CWE
CWE-763

Get alerted

Stop reading CVE feeds looking for your own stack

Track the products you run and VulnTracker tells you when a new CVE affects them — with what is known about fixing it, and nothing about the rest.

Free plan, no card