VAITP Dataset

← Back to the dataset

CVE-2026-59991

Memory‑dos via unchecked PSD header dimensions causing huge allocations.

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

psd-tools is a Python package for working with Adobe Photoshop PSD files. Prior to 1.17.4, PSDImage.composite() and PSDImage.numpy() allocated output buffers from attacker-controlled PSD header geometry, including width, height, channels, depth, and per-layer rectangles, before validating those values against the available file data. A tiny crafted PSD could therefore cause multi-gigabyte memory allocation, and PSDImage.composite() could return a black image with only a warning instead of raising an exception. Services that composite untrusted PSD files could be terminated by out-of-memory handling. This issue is fixed in version 1.17.4.

CVSS base score
7.5
Published
2026-09-22
OWASP
A05 Security Misconfiguration
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
psd-tools
Fixed by upgrading
Yes

Solution

Upgrade psd‑tools to version 1.17.4 or later.

Vulnerable code sample

import sys
from psd_tools import PSDImage

def render_psd(path):
    # VULNERABLE: unchecked header dimensions allow massive allocation
    img = PSDImage.open(path)
    # Composite triggers buffer allocation based on img.width, img.height
    result = img.composite()
    return result

Patched code sample

import sys
from psd_tools import PSDImage

MAX_PIXELS = 10000 * 10000  # 100 MP limit

def render_psd(path):
    # FIX: validate header dimensions before allocation
    img = PSDImage.open(path)
    if img.width * img.height > MAX_PIXELS:
        raise ValueError("Image dimensions exceed safe limit")
    result = img.composite()
    return result

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.

  • fix(compression): bound oversized allocation from undecodable channels (psd-tools/psd-tools)
    src/psd_tools/api/numpy_io.py · get_image_data, src/psd_tools/api/pil_io.py · convert_image_data_to_pil, src/psd_tools/api/utils.py, src/psd_tools/api/utils.py · check_pixel_size, src/psd_tools/compression/__init__.py, src/psd_tools/compression/__init__.py · decompress

Cite this entry

@misc{vaitp:cve202659991,
  title        = {{Memory‑dos via unchecked PSD header dimensions causing huge allocations.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-59991},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-59991/}}
}

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.