CVEfocus › CVE database › CVE-2021-21401

CVE-2021-21401Invalid free() call in Nanopb

CVSS 7.1 HighEPSS 1.8% (higher than 79% of CVEs)Published 2021-03-23Updated 2024-08-03Assigner: GitHub_M

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.

CWE-763

What to do

Fixed builds are available from Debian, PyPI: see the table below for the fixed version per release.

Ubuntu has not shipped a fix for every release yet.

Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.

curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \
  -H "Content-Type: text/plain" --data-binary @inventory.txt

Vendor status at a glance

4Fixed
1Fix pending
2Not affected

Status by vendor and release

From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.

ReleasePackageStatusFixed versionAdvisory
Ubuntu 24.04nanopbNot affected
vulnerable_code_not_present
Ubuntu 22.04nanopbNot affected
vulnerable_code_not_present
Ubuntu 20.04nanopbFix pending0.4.1-1ubuntu0.1~esm1 (Ubuntu Pro)UBUNTU-CVE-2021-21401
Debian 14nanopbFixed0.4.4-2DEBIAN-CVE-2021-21401
Debian 13nanopbFixed0.4.4-2DEBIAN-CVE-2021-21401
Debian 12nanopbFixed0.4.4-2DEBIAN-CVE-2021-21401
PyPI librarynanopbFixed0.4.5GHSA-7mv5-5mxh-qg88

What the vendor says

As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.

References

About this page

Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.