CVE-2021-21401: nanopb vulnerable to invalid free() call with oneofs and PB_ENABLE_MALLOC
7.1
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.42442%
CWE
Published
8/30/2024
Updated
8/30/2024
KEV Status
No
Technology
Python
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:L
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| nanopb | pip | >= 0.3.2, < 0.3.9.8 | 0.3.9.8 |
| nanopb | pip | >= 0.4.0, < 0.4.5 | 0.4.5 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from how oneof field switching was handled in pb_release_union_field. The commit diff shows a critical fix where pointer fields are explicitly initialized to NULL when switching oneof members. This addresses the core issue where previous non-pointer data could be misinterpreted as a pointer. The function's role in managing union field cleanup directly matches the vulnerability description of invalid pointer releases. The high confidence comes from the direct correlation between the patch location, commit message explanation, and the described vulnerability mechanism.