CVE-2025-8194: Tarfile infinite loop during parsing with negative member offset

Published Jul 28, 2025
·
Updated

Tarfile infinite loop during parsing with negative member offset

Other sources

There is a defect in the CPython “tarfile” module affecting the “TarFile” extraction and entry enumeration APIs. The tar implementation would process tar archives with negative offsets without error, resulting in an infinite loop and deadlock during the parsing of maliciously crafted tar archives.

This vulnerability can be mitigated by including the following patch after importing the “tarfile” module:

import tarfile

def blockpatched(self, count): if count < 0: # pragma: no cover raise tarfile.InvalidHeaderError("invalid offset") return blockpatched.origblock(self, count)

blockpatched.origblock = tarfile.TarInfo.block tarfile.TarInfo.block = blockpatched

Red Hat

There is a defect in the CPython “tarfile” module affecting the “TarFile” extraction and entry enumeration APIs. The tar implementation would process tar archives with negative offsets without error, resulting in an infinite loop and deadlock during the parsing of maliciously crafted tar archives.

This vulnerability can be mitigated by including the following patch after importing the “tarfile” module:  https://gist.github.com/sethmlarson/1716ac5b82b73dbcbf23ad2eff8b33e1

MITRE

Affected Software

4 affected componentsFixes available
pypi/tarfile
Microsoft azl3 python3 3.12.9-4
Microsoft cbl2 python3 3.9.19-14
Microsoft cbl2 python3 3.9.19-14

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Compensating control

    Mitigate CVE-2025-8194 by patching CPython tarfile after importing tarfile: set tarfile.TarInfo._block = _block_patched (where _block_patched calls the original tarfile.TarInfo._block only when count < 0, otherwise returns tarfile.InvalidHeaderError('invalid offset')).

Event History

Jul 28, 2025
CVE Published
via MITRE·06:42 PM
Data Sourced
via MITRE·06:42 PM
DescriptionSeverityWeakness
Data Sourced
via Red Hat·07:01 PM
DescriptionSeverityAffected Software
Data Sourced
via NVD·07:15 PM
DescriptionSeverityWeakness
Sep 4, 2025
Data Sourced
via Microsoft·02:31 AM
DescriptionSeverityWeaknessAffected Software
Updated
via Microsoft·09:31 AM
SeverityAffected Software
Updated
via Microsoft·09:31 AM
DescriptionSeverity
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 severity of CVE-2025-8194?

CVE-2025-8194 has been classified as a high-severity vulnerability due to the potential for infinite loops and deadlocks.

2

How does CVE-2025-8194 affect the CPython tarfile module?

CVE-2025-8194 affects the CPython tarfile module by allowing maliciously crafted tar archives to cause processing issues without initial errors.

3

What are the potential consequences of CVE-2025-8194?

The potential consequences of CVE-2025-8194 include application crashes and service denial due to infinite loops and deadlocks.

4

How can I mitigate CVE-2025-8194 in my applications?

To mitigate CVE-2025-8194, avoid using the affected APIs with untrusted tar archive inputs until a fix is applied.

5

When will a fix be available for CVE-2025-8194?

The timeline for a fix for CVE-2025-8194 will be communicated through the official Python Software Foundation channels.

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