REDHAT-BUG-2384043: Medium severity Python Software Foundation CPython vulnerability

Published Jul 28, 2025
·
Updated

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

Affected Software

1 affected component
Python Software Foundation CPython

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Configuration

    Mitigate by applying the provided runtime patch after importing the "tarfile" module: set _block_patched._orig_block = tarfile.TarInfo._block, then define _block_patched(self, count) that calls the original block when count < 0, and finally assign tarfile.TarInfo._block = _block_patched.

    CPython tarfile module TarInfo._block monkey-patch = _block_patched (wrapper calling tarfile.TarInfo._block, with negative count handling to avoid infinite loop)

Event History

Jul 28, 2025
Data Sourced
via Red Hat·07:01 PM
DescriptionSeverityAffected Software
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 REDHAT-BUG-2384043?

The severity of REDHAT-BUG-2384043 is critical due to the potential for infinite loops and deadlocks.

2

How do I fix REDHAT-BUG-2384043?

To fix REDHAT-BUG-2384043, update your CPython installation to the latest version where the defect has been addressed.

3

What versions of CPython are affected by REDHAT-BUG-2384043?

REDHAT-BUG-2384043 affects specific versions of CPython that incorporate the vulnerable tarfile implementation.

4

Can REDHAT-BUG-2384043 be exploited remotely?

Yes, remote exploitation is possible if a user processes maliciously crafted tar archives.

5

Is there a workaround for REDHAT-BUG-2384043?

The best workaround for REDHAT-BUG-2384043 is to avoid processing untrusted tar archives until a patch is applied.

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