Skip to main content

Python zipfile CVE-2025-8291

MEDIUM
Improper Validation of Specified Index, Position, or Offset in Input (CWE-1285)
2025-10-07 cna@python.org
4.3
CVSS 3.1 · Vendor: python
Share

Severity by source

Vendor (python) PRIMARY
4.3 MEDIUM
AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N
vuln.today AI
4.3 MEDIUM

Crafted ZIP delivered over network (AV:N) requires application or user to process it (UI:R); impact is integrity-only via parser inconsistency enabling bypass, with no confidentiality or availability effect.

3.1 AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N
4.0 AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N
SUSE
3.3 LOW
AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N
Red Hat
4.3 MEDIUM
qualitative

Primary rating from Vendor (python).

CVSS VectorVendor: python

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Unchanged
Confidentiality
None
Integrity
Low
Availability
None

Lifecycle Timeline

3
Source Code Evidence Fetched
Jul 30, 2026 - 23:39 vuln.today
Analysis Generated
Jul 30, 2026 - 23:39 vuln.today
CVE Published
Oct 07, 2025 - 18:16 cve.org
MEDIUM 4.3

DescriptionCVE.org

The 'zipfile' module would not check the validity of the ZIP64 End of Central Directory (EOCD) Locator record offset value would not be used to locate the ZIP64 EOCD record, instead the ZIP64 EOCD record would be assumed to be the previous record in the ZIP archive. This could be abused to create ZIP archives that are handled differently by the 'zipfile' module compared to other ZIP implementations.

Remediation maintains this behavior, but checks that the offset specified in the ZIP64 EOCD Locator record matches the expected value.

AnalysisAI

ZIP64 archive parsing inconsistency in Python's standard library zipfile module enables crafting specially constructed ZIP archives that Python processes differently than spec-compliant ZIP implementations, facilitating security control bypass in dual-parser pipelines. The module failed to use the offset field from the ZIP64 End of Central Directory Locator record to locate the ZIP64 EOCD record, instead assuming it was always the immediately preceding structure in the byte stream. No active exploitation is confirmed (not in CISA KEV), no public exploit code has been identified, and EPSS probability is low at 0.35% - real-world risk is concentrated in security tooling that uses Python's zipfile for validation while a separate implementation performs extraction.

Technical ContextAI

Python's standard library zipfile module supports ZIP64-format archives, which extend the original ZIP specification to accommodate files and archives exceeding 4GB limits. The ZIP64 End of Central Directory Locator record (magic bytes PK\x06\x07) contains an explicit offset field pointing to the ZIP64 EOCD record (magic bytes PK\x06\x06). CVE-2025-8291 reveals that CPython's zipfile implementation accepted this Locator record but ignored its offset field entirely, instead resolving the ZIP64 EOCD record positionally - assuming it was the record immediately preceding the Locator in the byte stream. CWE-1285 (Improper Validation of Specified Index, Position, or Offset Within a Buffer) precisely characterizes this root cause: the offset value was parsed but never used for actual record location. The commit diff confirms the fix adds validation that the offset in the Locator record matches the computed expected position, and raises BadZipFile on mismatch. This semantic gap between Python's parser and ZIP64-compliant implementations enables 'archive confusion' or 'zip polyglot' attacks, a technique where a single file is interpreted differently by two parsers reading the same byte stream.

Affected ProductsAI

All CPython releases shipping the zipfile standard library module prior to the backport patches are affected. Seven distinct fix commits were pushed to the CPython repository (PR #139702, issue #139700), indicating fixes were backported across multiple actively maintained CPython branches - historically spanning supported releases such as 3.9 through 3.13 and possibly 3.14 development. Specific patched release version numbers are not independently confirmed from available commit data; the Python Security Announce mailing list thread (mail.python.org/archives/list/security-announce@python.org/thread/QECOPWMTH4VPPJAXAH2BGTA4XADOP62G/) and PSF advisory PSF-2025-12 (github.com/psf/advisory-database/blob/main/advisories/python/PSF-2025-12.json) are the authoritative sources for confirmed version ranges. Any application embedding CPython and invoking zipfile to process externally-supplied ZIP64 archives is in scope.

RemediationAI

Upstream fix is available via multiple CPython commits on GitHub (PR #139702; commits 162997bb, 1d29afb0, 333d4a6f, 76437ac2, 8392b2f0, bca11ae7, d11e69d6); released patched CPython version numbers are not independently confirmed from the commit data alone - consult PSF advisory PSF-2025-12 and the Python Security Announce thread (mail.python.org/archives/list/security-announce@python.org/thread/QECOPWMTH4VPPJAXAH2BGTA4XADOP62G/) for confirmed release versions before upgrading. Upgrade CPython to any vendor-confirmed patched release as the primary remediation. As an interim compensating control for applications processing untrusted ZIP archives, add an upstream validation step using a separate, spec-compliant ZIP library (such as libarchive Python bindings) before passing archives to zipfile - this introduces additional processing overhead and a dependency but closes the dual-parser gap. Alternatively, if ZIP64 archive support is not operationally required, reject archives containing ZIP64 EOCD structures at the application perimeter; be aware this may break legitimate large-file workflows. Sandboxing or containerizing the ZIP-processing pipeline reduces blast radius if exploitation does occur.

Vendor StatusVendor

SUSE

Severity: Low
Product Status
Container bci/bci-base-fips:15.6.37.11 Container bci/bci-sle15-kernel-module-devel:15.6.56.10 Container bci/bci-sle15-kernel-module-devel:15.7-53.8 Container bci/spack:0.23.1-11.94 Container bci/spack:0.23.1-19.14 Container suse/kea:2.6 Container suse/kiosk/pulseaudio:17.0-67.15 Container suse/kiosk/tigervnc-x11vnc:latest Container suse/ltss/sle15.4/bci-base-fips:15.4.2.55 Container suse/manager/5.0/x86_64/server-migration-14-16:5.0.6.7.29.1 Container suse/mariadb:11.8.3-67.10 Container suse/multi-linux-manager/5.1/x86_64/server-migration-14-16:5.1.1.1.8.10.2 Container suse/postgres:16.14 Container suse/postgres:17.10 Container suse/postgres:18.3-contrib-65.3 Container suse/samba-client:4.21-69.12 Container suse/samba-server:4.21-69.14 Container suse/samba-toolbox:4.21-69.12 Container suse/sle-micro-rancher/5.2:latest Container suse/sle-micro/5.2/toolbox:14.2-7.11.211 Container suse/sle-micro/5.3/toolbox:16.3-6.11.222 Container suse/sle-micro/5.4/toolbox:16.3-5.19.222 Container suse/sle-micro/5.5/toolbox:16.3-3.12.133 Image SLES15-SP6-CHOST-BYOS-GCE Image SLES15-SP7-CHOST-BYOS-GCE Image server-database-migration-image Image server-migration-14-16-image Affected
Container containers/open-webui-mcpo:0.0.17-1.18 Container suse/multi-linux-manager/5.1/x86_64/server-saline:5.1.2.9.13.1 Image server-saline-image Affected
Container rancher/seedimage-builder:latest Container suse/sles/16.0/toolbox:16.3-1.17 Affected
Container suse/389-ds:2.5.3-65.11 Affected
Container suse/manager/4.3/proxy-httpd:4.3.16.1.9.70.16 Container suse/manager/4.3/proxy-salt-broker:4.3.16.1.9.60.16 Container suse/manager/4.3/proxy-ssh:4.3.16.1.9.60.9 Container suse/manager/4.3/proxy-tftpd:4.3.16.1.9.60.8 Container suse/manager/5.0/x86_64/proxy-httpd:5.0.6.7.29.2 Container suse/manager/5.0/x86_64/proxy-salt-broker:5.0.6.7.31.2 Container suse/manager/5.0/x86_64/proxy-ssh:5.0.6.7.29.1 Container suse/manager/5.0/x86_64/proxy-tftpd:5.0.6.7.29.1 Container suse/multi-linux-manager/5.1/x86_64/proxy-httpd:5.1.1.1.8.12.1 Container suse/multi-linux-manager/5.1/x86_64/proxy-squid:5.1.2.8.13.1 Container suse/multi-linux-manager/5.1/x86_64/proxy-ssh:5.1.1.1.8.10.1 Container suse/multi-linux-manager/5.1/x86_64/proxy-tftpd:5.1.1.1.8.10.1 Image SLES15-SP4-CHOST-BYOS-GCE Image SLES15-SP4-Micro-5-3-BYOS Image SLES15-SP4-Micro-5-3-BYOS-Azure Image SLES15-SP4-Micro-5-4-BYOS Image SLES15-SP4-Micro-5-4-BYOS-Azure Image SLES15-SP5-CHOST-BYOS-GCE Image proxy-httpd-image Image proxy-squid-image Image proxy-ssh-image Image proxy-tftpd-image Affected

Share

CVE-2025-8291 vulnerability details – vuln.today

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy