VAITP Dataset

← Back to the dataset

CVE-2026-112901

Pillow XBM header regex allows DoS with crafted files (fixed in 13.0.0).

  • CVSS 6.9
  • CWE-1333
  • Input Validation and Sanitization
  • Remote

Pillow is a Python imaging library. Prior to 13.0.0, Pillow's XBM header parser is vulnerable to regular-expression denial of service. In XbmImageFile._open, when an application calls Image.open() on a small crafted XBM file, XbmImagePlugin applies a backtracking expression to the attacker-controlled header before image dimensions are accepted, stalling a worker for minutes and denying service. This issue is fixed in version 13.0.0.

CVSS base score
6.9
Published
2026-10-19
OWASP
A06 Vulnerable and Outdated Components
Orthogonal defect classification
Timing/Serialization
Code defect classification
Timing Issues
Category
Input Validation and Sanitization
Subcategory
Insecure Parsing or Deserialization
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

import re
from PIL import Image, XbmImagePlugin

def load_xbm(path):
    # VULNERABLE: catastrophic backtracking on untrusted header
    with open(path, 'rb') as f:
        header = f.read(1024).decode('ascii', errors='ignore')
    # Pillow's original pattern (simplified) that can be abused
    m = re.search(r'(\d+\s+)+', header)
    if not m:
        raise ValueError("Invalid XBM header")
    width, height = map(int, m.group(0).split())
    return Image.open(path).convert('RGB')

Patched code sample

import re
from PIL import Image, XbmImagePlugin

def load_xbm(path):
    # FIX: use non-backtracking quantifier to limit parsing effort
    with open(path, 'rb') as f:
        header = f.read(1024).decode('ascii', errors='ignore')
    # Safer pattern: match a sequence of numbers without nested quantifiers
    m = re.search(r'(?:\d+\s+)*\d+', header)
    if not m:
        raise ValueError("Invalid XBM header")
    width, height = map(int, m.group(0).split())
    return Image.open(path).convert('RGB')

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:cve2026112901,
  title        = {{Pillow XBM header regex allows DoS with crafted files (fixed in 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-112901},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-112901/}}
}

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.