VAITP Dataset

← Back to the dataset

CVE-2026-96643

Quadratic CPU DoS via repeated EXIF headers in Pillow 11‑13 via eXIf chunk.

  • CVSS 7.1
  • CWE-407
  • Resource Management
  • Remote

Pillow is a Python imaging library. From 11.0.0 until 13.0.0, Exif.load() in src/PIL/Image.py repeatedly slices the remaining EXIF data while it begins with the six-byte Exif header. src/PIL/PngImagePlugin.py accepts an uncapped PNG eXIf chunk, so a file filled with repeated headers causes a new shrinking copy on every iteration and quadratic CPU work. The condition is reachable through Image.getexif(), Image._getexif(), and ImageOps.exif_transpose(), including common photo-upload rotation workflows. This issue is fixed in version 13.0.0.

CVSS base score
7.1
Published
2026-10-21
OWASP
A06 Vulnerable and Outdated Components
Orthogonal defect classification
Timing/Serialization
Code defect classification
Timing Issues
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_exif_quadratic(img_path: str):
    """Load EXIF data using Pillow's low‑level API.
    This reproduces the vulnerable loop that slices the data repeatedly."""
    img = Image.open(img_path)
    # VULNERABLE: unbounded slicing of EXIF data causes quadratic work
    exif_bytes = img.info.get("exif", b"")
    while exif_bytes.startswith(b"Exif\x00\x00"):
        # Simulate the library's repeated slicing
        exif_bytes = exif_bytes[6:]
    return exif_bytes

def process_image(img_path: str):
    # Trigger the vulnerable path via exif_transpose
    img = Image.open(img_path)
    transposed = ImageOps.exif_transpose(img)
    _ = load_exif_quadratic(img_path)
    return transposed

Patched code sample

from PIL import Image, ImageOps

def load_exif_quadratic(img_path: str):
    """Load EXIF data using Pillow's low‑level API.
    Fixed by limiting slicing to a single iteration."""
    img = Image.open(img_path)
    # FIX: stop slicing after the first header to prevent quadratic loops
    exif_bytes = img.info.get("exif", b"")
    if exif_bytes.startswith(b"Exif\x00\x00"):
        exif_bytes = exif_bytes[6:]
    return exif_bytes

def process_image(img_path: str):
    # Safe use of exif_transpose; the underlying load_exif now bounded
    img = Image.open(img_path)
    transposed = ImageOps.exif_transpose(img)
    _ = load_exif_quadratic(img_path)
    return transposed

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:cve202696643,
  title        = {{Quadratic CPU DoS via repeated EXIF headers in Pillow 11‑13 via eXIf chunk.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-96643},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-96643/}}
}

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.