Infinite Loop Vulnerability in Python's tarfile Module
Summary
CVE-2019-20907: In Lib/tarfile.py in Python through 3.8.3, an attacker is able to craft a TAR archive leading to an infinite loop when opened by tarfile.open, because _proc_pax lacks header validation. Affects python3 across 2 version ranges.
>= 2e789a1f1d84b343a996e8654590703b5fbdd441, < 426b022776672fdf3d71ddd98d89af341c88080f
< 3.8.5-r0
Fixed in 3.8.5-r0. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Python is a popular programming language known for its simplicity and versatility. It provides a built-in module called 'tarfile' that allows users to create, extract, and manipulate TAR archives. TAR is a file format used for archiving multiple files into a single file. However, the 'tarfile' module in Python versions up to 3.8.3 is vulnerable to an infinite loop when processing a specially crafted TAR archive. This vulnerability, identified as CVE-2019-20907, occurs due to a lack of header validation in the '_proc_pax' function.
Vulnerability Detail
The vulnerability allows an attacker to create a TAR archive that triggers an infinite loop when opened using the 'tarfile.open' function. By exploiting this vulnerability, an attacker can cause a denial-of-service (DoS) condition, potentially leading to resource exhaustion and system instability. The lack of header validation in the '_proc_pax' function enables the attacker to manipulate the TAR archive in a way that triggers the infinite loop.
How To Fix
Minimum fixed version
3.8.5-r0
This is the first release that contains the fix.
sudo apk add --upgrade python3
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a workaround, users can avoid opening untrusted TAR archives using the 'tarfile.open' function until the Python package is updated to a secure version. It is also advisable to exercise caution when handling TAR archives from untrusted sources.
Conclusion
The infinite loop vulnerability in Python's 'tarfile' module can be mitigated by updating the Python package to version 3.8.5 or later. It is crucial to keep software dependencies up to date to ensure the security and stability of the system. For further assistance in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for python3 →
FAQ
The vulnerability can lead to an infinite loop when processing a malicious TAR archive, causing a denial-of-service condition and potentially impacting system stability.
Python versions up to 3.8.3 are affected by this vulnerability.
While the vulnerability has been identified, there is no known public exploit available at the time of this report.
Updating the Python package to version 3.8.5 or later is the recommended mitigation for this vulnerability.
Yes, this vulnerability can be exploited remotely by enticing a user to open a malicious TAR archive using the vulnerable 'tarfile.open' function.
References
Related vulnerabilities
Recent vulnerabilities recorded for python3.