Thousands of Programs Compromised by a Critical Bug in Python

On many occasions, security flaws arise that put the programs and devices that we use in our day to day at risk. In this case, we are reporting an important vulnerability that affects IP address validation in Python , something that affects thousands of programs. We are going to explain what this problem consists of and how it can affect users.

A vulnerability in IP validation affects Python

This is a critical vulnerability that affects the Python standard library . It affects the validation of IP addresses, something that has already happened in the netmask library a few months ago. The bug has been registered as CVE-2021-29921.

Programs Compromised by a Critical Bug in Python

Specifically, it affects the ipaddress module in Python 3.x and is due to a change they made in 2019. As we say, a few months ago we saw a series of vulnerabilities that affected the subnet mask. Now it affects this standard Python library as well.

This vulnerability causes an incorrect parsing of IP addresses by the standard ipaddress library. This module makes sure that developers can easily create IP addresses, networks and interfaces. It should be noted that an IPv4 address can appear in decimal, integer, octal or hexadecimal format, although the most normal thing is that it appears in the first format.

Here comes the problem with leading zeros. This is the same as the netmask library. The way you handle that IP changes by adding a zero value before the IP in decimal format. The thing about the Python vulnerability is that the leading zeros would rule them out.

Código Python

This vulnerability allows remote attacks

Python’s IP validation flaw allows remote attacks . An unauthorized attacker could make fake server-side requests, remote file inclusion, or local files. This affects thousands of programs that are based on Python stdlib ipaddress, as indicated by the security researchers behind this discovery.

This vulnerability will be corrected by a security patch . Once again we can see the importance of always keeping our equipment, systems and any application that we use with the latest versions. In this way we will avoid risks that could be exploited by intruders to launch their attacks and affect the proper functioning and our own privacy.

However, as security researchers point out, it is rare to manage IP addresses with leading zeros. Therefore, it is not a failure that in practice can affect many users, although it is something that must be corrected to avoid problems.

It is always important to look for vulnerabilities. This will allow us to correct potential problems that could put our computers at risk, affect performance, and serve as a gateway for hackers. Luckily, there are many tools that we have available for this, to improve security at all times.

From this article we recommend installing all the patches and updates that are available. We have seen the example of this critical vulnerability in IP validation that affects Python and can compromise thousands of programs, but it is something that could be present in many online services.