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

— NVD

Affected Software

12 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
debian/pypy3*
debian/pypy3*
debian/pypy3<7.3.21+dfsg-1
7.3.21+dfsg-1
debian/python3.11<3.11.2-6+deb12u7
3.11.2-6+deb12u7
debian/python3.13<3.13.5-2+deb13u1
3.13.5-2+deb13u1
debian/pypy3<=7.3.11+dfsg-2+deb12u3, <=7.3.19+dfsg-2
8.0.1+dfsg-1
debian/python3.11
3.11.2-6+deb12u83.11.2-6+deb12u9
debian/python3.13
3.13.5-2+deb13u53.13.18-1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade debian/pypy3 to a version that resolves this vulnerability.

    Fixed in 7.3.21+dfsg-1
  2. Upgrade

    Upgrade debian/python3.11 to a version that resolves this vulnerability.

    Fixed in 3.11.2-6+deb12u7
  3. Upgrade

    Upgrade debian/python3.13 to a version that resolves this vulnerability.

    Fixed in 3.13.5-2+deb13u1
  4. Upgrade

    Upgrade debian/pypy3 to a version that resolves this vulnerability.

    Fixed in 8.0.1+dfsg-1
  5. Upgrade

    Upgrade debian/python3.11 to a version that resolves this vulnerability.

    Fixed in 3.11.2-6+deb12u8Fixed in 3.11.2-6+deb12u9
  6. Upgrade

    Upgrade debian/python3.13 to a version that resolves this vulnerability.

    Fixed in 3.13.5-2+deb13u5Fixed in 3.13.18-1
  7. 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
Data Sourced
via OSV·07:15 PM
Affected Software
Sep 4, 2025
Data Sourced
via Microsoft·02:31 AM
DescriptionSeverityWeaknessAffected Software

Peer vulnerabilities

Found alongside the following vulnerabilities.

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