Infinite Loop Vulnerability in Python's tarfile Module

python3 Updated 02 Oct 2025

Summary

13/07/2020
N/A
Yes i
High
7.5

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 ↓

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

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 →

Share this vulnerability

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.

Related vulnerabilities

Recent vulnerabilities recorded for python3.

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 →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback