Junglewise Threat Intelligence

CVE-2025-8291: Python CPython improper offset validation in zipfile module

CVE-2025-8291 · Severity: medium · CVSS 4.3 · Published 2025-10-07

Technologies: Python Software Foundation CPython. Vendors: Python Software Foundation.

Executive brief

The 'zipfile' module in Python, which is used by developers to read and write ZIP archive files, contains a flaw in how it processes large ZIP64 files. An attacker could create a specially crafted ZIP archive that Python handles differently than other standard ZIP tools. This discrepancy could be used to bypass security scanners or hide malicious content within archives that appear legitimate to other software.

Technical details

A vulnerability exists in the Python 'zipfile' module due to improper validation of the ZIP64 End of Central Directory (EOCD) Locator record offset. Instead of using the specified offset to locate the ZIP64 EOCD record, the module assumes the record is located immediately preceding the locator. An attacker can exploit this by crafting a ZIP archive with mismatched offsets, causing Python to interpret the archive structure differently than other ZIP parsers (CWE-1285). This could lead to security bypasses where malicious payloads are hidden from scanners but executed by Python applications. The fix ensures the offset specified in the locator record matches the expected internal value.

Affected products

  • Python Software Foundation CPython 3.10.0 to 3.10.18, 3.11.0 to 3.11.13, 3.12.0 to 3.12.11, 3.13.0 to 3.13.9, 3.14.0 to 3.14.0

Timeline

  • 2025-10-07: advisory
  • 2025-10-07: patched

References

Related threats