VAITP Dataset

← Back to the dataset

CVE-2026-112399

Memory exhaustion via crafted APNG causing full-canvas allocation in Pillow ≤13.0.0.

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

Pillow is a Python imaging library. From 8.1.0 until 13.0.0, Pillow can allocate an APNG disposal background at the full canvas size before applying the decompression-bomb check. A crafted APNG with a small first frame, a very large declared canvas, and background disposal or first-frame OP_PREVIOUS reaches PngImageFile._seek while Image.open() positions frame zero. The full-canvas allocation occurs inside Image.open() without requiring pixel loading or frame iteration. This can exhaust memory and deny service. This issue is fixed in version 13.0.0.

CVSS base score
8.7
Published
2026-10-19
OWASP
A06 Vulnerable and Outdated Components
Orthogonal defect classification
Algorithm
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

def load_image(path: str) -> Image.Image:
    # VULNERABLE: opens APNG without pre‑checking canvas size, can allocate full canvas
    img = Image.open(path)
    # The image is not yet loaded; Pillow may allocate a full‑canvas buffer here.
    img.load()
    return img

Patched code sample

from PIL import Image

def load_image(path: str) -> Image.Image:
    # FIX: set a pixel limit before opening to abort large canvases early
    Image.MAX_IMAGE_PIXELS = 10_000_000  # 10 MP limit
    img = Image.open(path)
    img.load()
    return 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:cve2026112399,
  title        = {{Memory exhaustion via crafted APNG causing full-canvas allocation in Pillow ≤13.0.0.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-112399},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-112399/}}
}

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.