VAITP Dataset

← Back to the dataset

CVE-2026-15310

Memory exhaustion via attacker‑controlled pre‑allocation in zip decompression.

  • CVSS 2.1
  • CWE-400
  • Resource Management
  • Remote

When decompressing crafted zip files using the bzip/LZMA/Zstandard compressions, Python could use an attacker-controlled size to pre-allocate memory, possibly resulting in memory exhaustion.

CVSS base score
2.1
Published
2026-08-25
OWASP
A05 Security Misconfiguration
Orthogonal defect classification
Assignment
Code defect classification
Incorrect Assignment
Category
Resource Management
Subcategory
Resource Exhaustion
Accessibility scope
Remote
Impact
Denial of Service (DoS)
Affected component
Python
Fixed by upgrading
Yes

Solution

Upgrade Python to 3.11.7 or newer (or 3.12.2 or newer) where the zipfile memory‑allocation issue is patched.

Vulnerable code sample

import zipfile
import os

def extract_zip(zip_path, dest_dir):
    # VULNERABLE: uncontrolled memory allocation during extraction
    with zipfile.ZipFile(zip_path, 'r') as zf:
        for info in zf.infolist():
            # Directly read the entire compressed entry, allowing attacker‑controlled size
            data = zf.read(info.filename)
            target_path = os.path.join(dest_dir, info.filename)
            os.makedirs(os.path.dirname(target_path), exist_ok=True)
            with open(target_path, 'wb') as out_fp:
                out_fp.write(data)

Patched code sample

import zipfile
import os

def extract_zip(zip_path, dest_dir):
    # FIX: enforce a maximum uncompressed size per entry
    MAX_UNCOMPRESSED = 10 * 1024 * 1024  # 10 MiB
    with zipfile.ZipFile(zip_path, 'r') as zf:
        for info in zf.infolist():
            if info.file_size > MAX_UNCOMPRESSED:
                continue  # skip overly large entries
            # Read in bounded chunks to avoid large pre‑allocation
            with zf.open(info, 'r') as src_fp:
                target_path = os.path.join(dest_dir, info.filename)
                os.makedirs(os.path.dirname(target_path), exist_ok=True)
                with open(target_path, 'wb') as out_fp:
                    while True:
                        chunk = src_fp.read(1024 * 1024)
                        if not chunk:
                            break
                        out_fp.write(chunk)

Published fix

Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.

Cite this entry

@misc{vaitp:cve202615310,
  title        = {{Memory exhaustion via attacker‑controlled pre‑allocation in zip decompression.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-15310},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-15310/}}
}

Download this entry as JSON Download the whole dataset

Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.