VAITP Dataset

← Back to the dataset

CVE-2026-128066

Memory exhaustion via crafted TIFF/EXIF causing quadratic allocation in Pillow ≤12.3.0.

  • CVSS 8.7
  • CWE-770
  • Resource Management
  • Remote

Pillow is a Python imaging library. From 1.0 through 12.3.0, ImageFileDirectory_v2.load() in src/PIL/TiffImagePlugin.py retains a separate bytes object for each out-of-line IFD tag value without limiting the total data read or preventing distinct tags from referencing the same file region. A small crafted TIFF or EXIF-bearing JPEG, PNG, WebP, or MPO can therefore cause memory use quadratic in the input size. TIFF and some JPEG paths trigger parsing during Image.open(), while other formats are exposed when EXIF is requested, including through getexif() or ImageOps.exif_transpose(). The declared pixel dimensions do not bound this metadata allocation, so decompression-bomb checks do not prevent process memory exhaustion. This issue is fixed in version 13.0.0.

CVSS base score
8.7
Published
2026-11-12
OWASP
A04 Insecure Design
Orthogonal defect classification
Checking
Code defect classification
Missing Check
Category
Resource Management
Subcategory
Resource Exhaustion
Accessibility scope
Remote
Impact
Denial of Service (DoS)
Affected component
Pillow
Fixed by upgrading
Yes

Solution

Upgrade Pillow to version 13.0.0 (or later).

Vulnerable code sample

from PIL import Image, ImageOps

def load_image_with_exif(path: str) -> Image.Image:
    # VULNERABLE: unbounded allocation while loading EXIF IFD tags
    img = Image.open(path)
    # Trigger EXIF parsing which may allocate quadratic memory
    return ImageOps.exif_transpose(img)

Patched code sample

from PIL import Image, ImageOps, TiffImagePlugin

def load_image_with_exif(path: str) -> Image.Image:
    # FIX: cap total bytes read for out‑of‑line IFD tags
    TiffImagePlugin.ImageFileDirectory_v2.MAX_TAG_BYTES = 1_048_576  # 1 MiB limit
    img = Image.open(path)
    return ImageOps.exif_transpose(img)

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:cve2026128066,
  title        = {{Memory exhaustion via crafted TIFF/EXIF causing quadratic allocation in Pillow ≤12.3.0.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-128066},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-128066/}}
}

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.