# CVE-2021-29921: Security feature bypass in n/a

> Attackers can bypass IP-based access controls by exploiting leading zero handling in the Python ipaddress library.

- **Severity:** Critical 9.8 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 6 May 2021
- **Updated:** 8 Oct 2026
- **Also known as:** ALPINE-CVE-2021-29921, BIT-libpython-2021-29921, BIT-python-2021-29921, BIT-python-min-2021-29921, CLEANSTART-2026-JU50054, DEBIAN-CVE-2021-29921, GHSA-cxqv-r2cc-r9c9, MGASA-2021-0386, PSF-2021-2, SUSE-SU-2021:2940-1, UBUNTU-CVE-2021-29921, USN-4973-1, USN-4973-2

## What is CVE-2021-29921?

CVE-2021-29921 is a critical vulnerability in Oracle Communications Cloud Native Core Automated Test Suite, published on 6 May 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

In Python before 3,9,5, the ipaddress library mishandles leading zero characters in the octets of an IP address string. This (in some situations) allows attackers to bypass access control that is based on IP addresses.

## Which versions are affected by CVE-2021-29921?

3 open source packages ship an affected version, including libpython, python and python-min. It affects 6 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `libpython` | Bitnami | From 3.8.0 | 3.8.12, 3.9.5 |
| `python` | Bitnami | From 3.8.0 | 3.8.12, 3.9.5 |
| `python-min` | Bitnami | From 3.8.0 | 3.8.12, 3.9.5 |
| `python39` | SUSE:Linux Enterprise Module for Basesystem 15 SP3 | All versions | 3.9.6-4.3.4 |
| `python39-core` | SUSE:Linux Enterprise Module for Basesystem 15 SP3 | All versions | 3.9.6-4.3.3 |
| `python39-core` | SUSE:Linux Enterprise Module for Development Tools 15 SP3 | All versions | 3.9.6-4.3.3 |

Products: Oracle Communications Cloud Native Core Automated Test Suite, Oracle Communications Cloud Native Core Binding Support Function, Oracle Communications Cloud Native Core Network Slice Selection Function, Oracle Graalvm, Oracle Zfs Storage Appliance Kit, Python Python.

## How do I fix CVE-2021-29921?

Upgrade libpython to a fixed version for your release line: 3.8.12 or 3.9.5.

## Is CVE-2021-29921 being exploited?

There is no known exploitation of CVE-2021-29921 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2021-29921 and fix it if it is affected.

What it is: CVE-2021-29921 is a critical vulnerability in Oracle Communications Cloud Native Core Automated Test Suite, published on 6 May 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2021-29921 in the wild and no public exploit code.

Affected packages and fixed versions:
- libpython (Bitnami): affected from 3.8.0; fixed in 3.8.12, 3.9.5
- python (Bitnami): affected from 3.8.0; fixed in 3.8.12, 3.9.5
- python-min (Bitnami): affected from 3.8.0; fixed in 3.8.12, 3.9.5

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2021-29921/ (Markdown: https://insights.sbomify.com/CVE-2021-29921/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2021-29921
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2021-29921
- OSV: https://osv.dev/vulnerability/CVE-2021-29921

---
From sbomify Insights: https://insights.sbomify.com/CVE-2021-29921/
Summaries are generated and may contain mistakes; the official description above is the record.
