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

43 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
bitnami/libpython<3.9.24
3.9.24
bitnami/libpython>=3.10.0<3.10.19
3.10.19
bitnami/libpython>=3.11.0<3.11.14
3.11.14
bitnami/libpython>=3.12.0<3.12.12
3.12.12
bitnami/libpython>=3.13.0<3.13.6
3.13.6
bitnami/python-min<3.9.24
3.9.24
bitnami/python-min>=3.10.0<3.10.19
3.10.19
bitnami/python-min>=3.11.0<3.11.14
3.11.14
bitnami/python-min>=3.12.0<3.12.12
3.12.12
bitnami/python-min>=3.13.0<3.13.6
3.13.6
bitnami/python<3.9.24
3.9.24
bitnami/python>=3.10.0<3.10.19
3.10.19
bitnami/python>=3.11.0<3.11.14
3.11.14
bitnami/python>=3.12.0<3.12.12
3.12.12
bitnami/python>=3.13.0<3.13.6
3.13.6
ubuntu/python2.7<2.7.6-8ubuntu0.6+esm26
2.7.6-8ubuntu0.6+esm26
ubuntu/python3.4<3.4.3-1ubuntu1~14.04.7+esm16
3.4.3-1ubuntu1~14.04.7+esm16
ubuntu/python3.5<3.5.2-2ubuntu0~16.04.4~14.04.1+esm7
3.5.2-2ubuntu0~16.04.4~14.04.1+esm7
ubuntu/python2.7<2.7.12-1ubuntu0~16.04.18+esm17
2.7.12-1ubuntu0~16.04.18+esm17
ubuntu/python3.5<3.5.2-2ubuntu0~16.04.13+esm19
3.5.2-2ubuntu0~16.04.13+esm19
ubuntu/python2.7<2.7.17-1~18.04ubuntu1.13+esm12
2.7.17-1~18.04ubuntu1.13+esm12
ubuntu/python3.6<3.6.9-1~18.04ubuntu1.13+esm6
3.6.9-1~18.04ubuntu1.13+esm6
ubuntu/python3.7<3.7.5-2ubuntu1~18.04.2+esm7
3.7.5-2ubuntu1~18.04.2+esm7
ubuntu/python3.8<3.8.0-3ubuntu1~18.04.2+esm6
3.8.0-3ubuntu1~18.04.2+esm6
ubuntu/python3.8<3.8.10-0ubuntu1~20.04.18+esm2
3.8.10-0ubuntu1~20.04.18+esm2
ubuntu/python3.9<3.9.5-3ubuntu0~20.04.1+esm6
3.9.5-3ubuntu0~20.04.1+esm6
ubuntu/python3.10<3.10.12-1~22.04.11
3.10.12-1~22.04.11
ubuntu/python2.7<2.7.18-13ubuntu1.5+esm7
2.7.18-13ubuntu1.5+esm7
ubuntu/python3.11<3.11.0~rc1-1~22.04.1~esm5
3.11.0~rc1-1~22.04.1~esm5
ubuntu/python3.12<3.12.3-1ubuntu0.8
3.12.3-1ubuntu0.8
ubuntu/python3.13<3.13.6-1
3.13.6-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. Upgrade

    Upgrade bitnami/libpython to a version that resolves this vulnerability.

    Fixed in 3.9.24
  8. Upgrade

    Upgrade bitnami/libpython to a version that resolves this vulnerability.

    Fixed in 3.10.19
  9. Upgrade

    Upgrade bitnami/libpython to a version that resolves this vulnerability.

    Fixed in 3.11.14
  10. Upgrade

    Upgrade bitnami/libpython to a version that resolves this vulnerability.

    Fixed in 3.12.12
  11. Upgrade

    Upgrade bitnami/libpython to a version that resolves this vulnerability.

    Fixed in 3.13.6
  12. Upgrade

    Upgrade bitnami/python-min to a version that resolves this vulnerability.

    Fixed in 3.9.24
  13. Upgrade

    Upgrade bitnami/python-min to a version that resolves this vulnerability.

    Fixed in 3.10.19
  14. Upgrade

    Upgrade bitnami/python-min to a version that resolves this vulnerability.

    Fixed in 3.11.14
  15. Upgrade

    Upgrade bitnami/python-min to a version that resolves this vulnerability.

    Fixed in 3.12.12
  16. Upgrade

    Upgrade bitnami/python-min to a version that resolves this vulnerability.

    Fixed in 3.13.6
  17. Upgrade

    Upgrade bitnami/python to a version that resolves this vulnerability.

    Fixed in 3.9.24
  18. Upgrade

    Upgrade bitnami/python to a version that resolves this vulnerability.

    Fixed in 3.10.19
  19. Upgrade

    Upgrade bitnami/python to a version that resolves this vulnerability.

    Fixed in 3.11.14
  20. Upgrade

    Upgrade bitnami/python to a version that resolves this vulnerability.

    Fixed in 3.12.12
  21. Upgrade

    Upgrade bitnami/python to a version that resolves this vulnerability.

    Fixed in 3.13.6
  22. Upgrade

    Upgrade ubuntu/python2.7 to a version that resolves this vulnerability.

    Fixed in 2.7.6-8ubuntu0.6+esm26
  23. Upgrade

    Upgrade ubuntu/python3.4 to a version that resolves this vulnerability.

    Fixed in 3.4.3-1ubuntu1~14.04.7+esm16
  24. Upgrade

    Upgrade ubuntu/python3.5 to a version that resolves this vulnerability.

    Fixed in 3.5.2-2ubuntu0~16.04.4~14.04.1+esm7
  25. Upgrade

    Upgrade ubuntu/python2.7 to a version that resolves this vulnerability.

    Fixed in 2.7.12-1ubuntu0~16.04.18+esm17
  26. Upgrade

    Upgrade ubuntu/python3.5 to a version that resolves this vulnerability.

    Fixed in 3.5.2-2ubuntu0~16.04.13+esm19
  27. Upgrade

    Upgrade ubuntu/python2.7 to a version that resolves this vulnerability.

    Fixed in 2.7.17-1~18.04ubuntu1.13+esm12
  28. Upgrade

    Upgrade ubuntu/python3.6 to a version that resolves this vulnerability.

    Fixed in 3.6.9-1~18.04ubuntu1.13+esm6
  29. Upgrade

    Upgrade ubuntu/python3.7 to a version that resolves this vulnerability.

    Fixed in 3.7.5-2ubuntu1~18.04.2+esm7
  30. Upgrade

    Upgrade ubuntu/python3.8 to a version that resolves this vulnerability.

    Fixed in 3.8.0-3ubuntu1~18.04.2+esm6
  31. Upgrade

    Upgrade ubuntu/python3.8 to a version that resolves this vulnerability.

    Fixed in 3.8.10-0ubuntu1~20.04.18+esm2
  32. Upgrade

    Upgrade ubuntu/python3.9 to a version that resolves this vulnerability.

    Fixed in 3.9.5-3ubuntu0~20.04.1+esm6
  33. Upgrade

    Upgrade ubuntu/python3.10 to a version that resolves this vulnerability.

    Fixed in 3.10.12-1~22.04.11
  34. Upgrade

    Upgrade ubuntu/python2.7 to a version that resolves this vulnerability.

    Fixed in 2.7.18-13ubuntu1.5+esm7
  35. Upgrade

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

    Fixed in 3.11.0~rc1-1~22.04.1~esm5
  36. Upgrade

    Upgrade ubuntu/python3.12 to a version that resolves this vulnerability.

    Fixed in 3.12.3-1ubuntu0.8
  37. Upgrade

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

    Fixed in 3.13.6-1
  38. 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
Jul 29, 2025
Updated
via MITRE·01:37 PM
Description
Updated
via NVD·02:15 PM
Description
Aug 11, 2025
Advisory Published
via OSV·02:00 PM
Aug 29, 2025
Event
via FIRST·12:00 AM
Sep 4, 2025
Data Sourced
via Microsoft·02:31 AM
DescriptionSeverityWeaknessAffected Software
Nov 24, 2026
Data Sourced
via OSV·02:55 PM
Affected 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