CVE-2020-26243: Memory Leak in Nanopb Package

nanopb Updated 06 Jul 2026

Summary

02/07/2026
Yes i
Moderate
7.5

CVE-2020-26243: Memory leak in Nanopb. Affects nanopb across 2 version ranges.

>= 0.3.2, < 0.3.9.7 >= 0.4.0, < 0.4.4

Fixed in 0.3.9.7 or 0.4.4, depending on the release line you run. How to fix ↓

Also tracked for

The same CVE-2020-26243 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Nanopb is a small code-size Protocol Buffers implementation in C, designed for use in embedded systems. It allows developers to serialize structured data efficiently, making it suitable for applications where memory and processing power are limited. However, it is vulnerable to a memory leak issue when decoding specific message formats, particularly when dynamic allocation is enabled.

Vulnerability Detail

The vulnerability arises when decoding specially crafted messages that contain a 'oneof' field with a static submessage that includes a dynamic field. If the message being decoded contains this submessage multiple times, it can lead to a memory leak. This issue is particularly concerning when handling untrusted data, as it can result in excessive memory consumption and potential denial of service.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • >= 0.3.2, < 0.3.9.7 0.3.9.7
    pip install --upgrade "nanopb==0.3.9.7"
  • >= 0.4.0, < 0.4.4 0.4.4
    pip install --upgrade "nanopb==0.4.4"

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

  • 0: Set the option 'no_unions' for the oneof field in your Nanopb configuration. This will generate fields as separate entities instead of using C unions, thus avoiding the problematic code.

  • 1: Change the type of the submessage field inside the oneof to 'FT_POINTER'. This ensures that the entire submessage is dynamically allocated, preventing the execution of the problematic code.

  • 2: Utilize an arena allocator for Nanopb to ensure that all allocated memory can be released properly after use.

Conclusion

The CVE-2020-26243 vulnerability in the Nanopb package poses a significant risk of memory leaks when decoding certain message formats. It is crucial to update to the patched versions or apply the suggested workarounds to protect your applications from potential denial of service attacks.

See every vulnerability recorded for nanopb →

Share this vulnerability

FAQ

CVE-2020-26243 is a vulnerability in the Nanopb package that can lead to memory leaks when decoding specific message formats.

You can check if your application is affected by using the Vulert playground at Vulert Scanner, which allows you to monitor for open-source vulnerabilities without requiring signup.

The main consequence is a memory leak that can lead to excessive memory consumption, potentially resulting in a denial of service for applications processing untrusted data.

Yes, patches are available in versions 0.3.9.7 and 0.4.4 of the Nanopb package. It is recommended to update to these versions.

If an immediate update is not possible, consider applying the provided workarounds to mitigate the risk of memory leaks.

Related vulnerabilities

Recent vulnerabilities recorded for nanopb.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • >= 0.3.2, < 0.3.9.7 0.3.9.7
    pip install --upgrade "nanopb==0.3.9.7"
  • >= 0.4.0, < 0.4.4 0.4.4
    pip install --upgrade "nanopb==0.4.4"

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback