PSF-2021-2: Critical severity Python Software Foundation Python vulnerability
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
Event History
Frequently Asked Questions
What kinds of deployments are exposed?
Deployments using Python versions before 3.9.5 are affected when they use the ipaddress library to make access-control decisions based on IP address strings.
What does an attacker need to exploit this issue?
The issue can be exploited remotely without privileges or user interaction. An attacker needs to provide an IP address string with leading zero characters in its octets in a situation where that parsing can bypass IP-address-based access control.
Are default Python installations necessarily vulnerable in practice?
The affected parsing behavior exists in Python before 3.9.5, but practical exposure depends on whether an application uses the ipaddress library for IP-address-based access control.
What should teams do if they cannot patch immediately?
Review and restrict any access-control logic that relies on ipaddress parsing of attacker-supplied IP address strings, particularly strings whose octets may contain leading zero characters. Do not rely on the affected parsing behavior to enforce IP-based authorization.