What’s Vulnerable › Vulnerabilities
CVE-2020-5235: Out-of-memory condition in Nanopb is potentially exploitable
- Severity: critical (CVSS 9.8 v3.1)
- Exploited in the wild: not listed in CISA KEV
- EPSS: 1.7% probability of exploitation in the next 30 days
- Public exploit or detection template: none known
- Published: 2020-02-04 · updated 2026-06-17
- Weakness: CWE-125
Description
There is a potentially exploitable out of memory condition In Nanopb before 0.4.1, 0.3.9.5, and 0.2.9.4. When nanopb is compiled with PB_ENABLE_MALLOC, the message to be decoded contains a repeated string, bytes or message field and realloc() runs out of memory when expanding the array nanopb can end up calling `free()` on a pointer value that comes from uninitialized memory. Depending on platform this can result in a crash or further memory corruption, which may be exploitable in some cases. This problem is fixed in nanopb-0.4.1, nanopb-0.3.9.5, nanopb-0.2.9.4.
Affected products
- nanopb: before 0.2.9.4; from 0.3.0 before 0.3.9.5; from 0.4.0 before 0.4.1 — fixed in 0.2.9.4, 0.3.9.5, 0.4.1
How to fix
Upgrade to a fixed version: nanopb 0.2.9.4, 0.3.9.5, 0.4.1. Check the vendor advisory for mitigations.
References
- https://github.com/nanopb/nanopb/commit/45582f1f97f49e2abfdba1463d1e1027682d9856
- https://github.com/nanopb/nanopb/commit/7b396821ddd06df8e39143f16e1dc0a4645b89a3
- https://github.com/nanopb/nanopb/commit/aa9d0d1ca78d6adec3adfeecf3a706c7f9df81f2
- https://github.com/nanopb/nanopb/security/advisories/GHSA-gcx3-7m76-287p
- https://github.com/nanopb/nanopb/commit/45582f1f97f49e2abfdba1463d1e1027682d9856
- https://github.com/nanopb/nanopb/commit/7b396821ddd06df8e39143f16e1dc0a4645b89a3
- https://github.com/nanopb/nanopb/commit/aa9d0d1ca78d6adec3adfeecf3a706c7f9df81f2
- https://github.com/nanopb/nanopb/security/advisories/GHSA-gcx3-7m76-287p
Get alerted when CVE-2020-5235 or the next vulnerability affects your stack