CVE-2021-29921: Input Validation

Published Apr 30, 2021
·
Updated

A flaw was found in python-ipaddress. Improper input validation of octal strings in stdlib ipaddress allows unauthenticated remote attackers to perform indeterminate SSRF, RFI, and LFI attacks on many programs that rely on Python stdlib ipaddress. The highest threat from this vulnerability is to data integrity and system availability.

Other sources

Improper input validation of octal strings in Python 3.8.0 thru v3.10 stdlib ipaddress allows unauthenticated remote attackers to perform indeterminate SSRF, RFI, and LFI attacks on many programs that rely on Python stdlib ipaddress. IP address octects are left stripped instead of evaluated as valid IP addresses. For example, an attacker submitting an IP address to a web application that relies on stdlib ipaddress, could cause SSRF via inputting octal input data; An attacker can submit exploitable IP addresses if the octet is 3 digits, with the minimum exploitable octect being 08 (Denial of Service) and the maximum exploitable octet is 099. For example, an attacker can submit 010.8.8.8, which is 8.8.8.8, yet Python ipaddress builtin will evaluate this as 10.8.8.8.

References:

https://bugs.python.org/issue36384#msg392423

Red Hat

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.

Affected Software

19 affected componentsFixes available
redhat/rh-python38-babel<0:2.7.0-12.el7
0:2.7.0-12.el7
redhat/rh-python38-python<0:3.8.11-2.el7
0:3.8.11-2.el7
redhat/rh-python38-python-cryptography<0:2.8-5.el7
0:2.8-5.el7
redhat/rh-python38-python-jinja2<0:2.10.3-6.el7
0:2.10.3-6.el7
redhat/rh-python38-python-lxml<0:4.4.1-7.el7
0:4.4.1-7.el7
redhat/rh-python38-python-pip<0:19.3.1-2.el7
0:19.3.1-2.el7
redhat/rh-python38-python-urllib3<0:1.25.7-7.el7
0:1.25.7-7.el7
redhat/python<3.9
3.9
Python Python>=3.8.0<3.8.12
Python Python>=3.9.0<3.9.5
Oracle Communications Cloud Native Core Automated Test Suite=1.8.0
Oracle Communications Cloud Native Core Binding Support Function=1.11.0
Oracle Communications Cloud Native Core Network Slice Selection Function=1.8.0
Oracle GraalVM=20.3.2
Oracle GraalVM=21.1.0
Oracle ZFS Storage Appliance Kit=8.8
debian/pypy3
7.3.5+dfsg-2+deb11u27.3.5+dfsg-2+deb11u47.3.11+dfsg-2+deb12u37.3.19+dfsg-1
debian/python2.7
2.7.18-8+deb11u1
debian/python3.9<=3.9.2-1
3.9.2-1+deb11u3

Event History

Apr 30, 2021
CVE Published
12:00 AM
May 5, 2021
Data Sourced
via Red Hat·07:35 PM
DescriptionSeverityAffected Software
May 6, 2021
CVE Published
via MITRE·12:00 AM
Data Sourced
via MITRE·12:00 AM
Description
Data Sourced
via NVD·01:15 PM
RemedyDescriptionSeverityAffected Software
Jul 11, 2024
Data Sourced
via Launchpad·12:44 PM
Description
Sep 13, 2024
Data Sourced
via Ubuntu·12:55 PM
RemedyDescriptionSeverityAffected Software

Parent advisories

This vulnerability appears in the following advisories.

Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the vulnerability ID?

The vulnerability ID is CVE-2021-29921.

2

What is the severity of CVE-2021-29921?

The severity of CVE-2021-29921 is critical.

3

How does CVE-2021-29921 affect Python before version 3.9.5?

CVE-2021-29921 allows unauthenticated remote attackers to perform SSRF, RFI, and LFI attacks on programs that rely on Python stdlib ipaddress.

4

How can I fix CVE-2021-29921?

To fix CVE-2021-29921, update to Python version 3.9.5 or later.

5

Where can I find more information about CVE-2021-29921?

You can find more information about CVE-2021-29921 at the following references: [CVE-2021-29921](https://www.cve.org/CVERecord?id=CVE-2021-29921), [NVD](https://nvd.nist.gov/vuln/detail/CVE-2021-29921), [Python Security](https://python-security.readthedocs.io/vuln/ipaddress-ipv4-leading-zeros.html), [Red Hat Bugzilla](https://bugzilla.redhat.com/show_bug.cgi?id=1957458), [Red Hat Security Advisory](https://access.redhat.com/errata/RHSA-2021:4160).

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203