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 products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| nanopb | nanopb | >= 0.3.2, <= 0.3.9.7, >= 0.4.0, <= 0.4.4 | — |
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 14 | nanopb | 0.4.4-2 | — |
| Debian 13 | nanopb | 0.4.4-2 | — |
| Debian 12 | nanopb | 0.4.4-2 | — |
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu Pro 20.04 LTS | nanopb | 0.4.1-1ubuntu0.1~esm1 | USN-6121-1 |
openSUSE
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| openSUSE Tumbleweed | nanopb | 0.4.5-1.3 | openSUSE-SU-2024:11074-1 |
Public exploits
Exploit or proof-of-concept code for this vulnerability is publicly available, which lowers the bar for attackers. Treat it as a reason to patch sooner.
GitHub 1 repository
-
uthrasri/CVE-2021-21401_nanopb-c_AOSP10_R33 ★ 0 · Nov 5, 2024
Sources: PoC-in-GitHub, Metasploit Framework, Exploit-DB — updated daily. Only links are listed; no exploit code is hosted here.
Affected packages
| Ecosystem | Package | Affected | Fixed | Record |
|---|---|---|---|---|
| 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 |
| PyPI | nanopb | < 0.3.9.8 · >= 0.4.0, < 0.4.5 | 0.3.9.8, 0.4.5 | PYSEC-2021-432 |
Advisories 2
- USN-6121-1 nanopb vulnerabilities Ubuntu Security Notices (USN) · Apr 22, 2026
- openSUSE-SU-2024:11074-1 libprotobuf-nanopb0-0.4.5-1.3 on GA media SUSE / openSUSE Security Updates · Feb 4, 2026