VAITP Dataset

← Back to the dataset

CVE-2026-103000

Memory exhaustion via overly long PDF page-label strings (pre‑6.19.0).

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

pypdf is a free and open-source pure-python PDF library. Prior to 6.19.0, a crafted PDF can provide unusually large alphabetical page-label values that cause pypdf/_page_labels.py to generate strings beyond a reasonable page-label length when an application retrieves document page labels, consuming excessive memory and potentially making the application unavailable. This issue is fixed in version 6.19.0.

CVSS base score
8.7
Published
2026-09-30
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
pypdf
Fixed by upgrading
Yes

Solution

Upgrade pypdf to version 6.19.0 or later.

Vulnerable code sample

import re
from pypdf import PdfReader

def get_page_labels(pdf_path):
    """Return list of page label strings from a PDF."""
    reader = PdfReader(pdf_path)
    # VULNERABLE: unbounded concatenation of label strings
    labels = []
    for i, label_dict in enumerate(reader.trailer["/Root"].get("/PageLabels", [])):
        prefix = label_dict.get("/P", "")
        start = label_dict.get("/St", 1)
        style = label_dict.get("/S", "/D")
        # Build label for each page without size limit
        for n in range(start, start + label_dict.get("/N", 1)):
            if style == "/A":
                # alphabetical label (e.g., A, B, ... AA, AB, ...)
                label = prefix + _num_to_alpha(n)
            else:
                label = prefix + str(n)
            labels.append(label)
    return labels

def _num_to_alpha(num):
    """Convert 1-indexed number to alphabetical string (A, B, ..., Z, AA, AB, ...)"""
    result = []
    while num > 0:
        num, rem = divmod(num - 1, 26)
        result.append(chr(65 + rem))
    return ''.join(reversed(result))

Patched code sample

import re
from pypdf import PdfReader

def get_page_labels(pdf_path):
    """Return list of page label strings from a PDF."""
    reader = PdfReader(pdf_path)
    # FIX: enforce maximum label length to prevent exhaustion
    MAX_LABEL_LEN = 100
    labels = []
    for i, label_dict in enumerate(reader.trailer["/Root"].get("/PageLabels", [])):
        prefix = label_dict.get("/P", "")
        start = label_dict.get("/St", 1)
        style = label_dict.get("/S", "/D")
        for n in range(start, start + label_dict.get("/N", 1)):
            if style == "/A":
                label = prefix + _num_to_alpha(n)
            else:
                label = prefix + str(n)
            if len(label) > MAX_LABEL_LEN:
                raise ValueError("Page label exceeds maximum allowed length")
            labels.append(label)
    return labels

def _num_to_alpha(num):
    """Convert 1-indexed number to alphabetical string (A, B, ..., Z, AA, AB, ...)"""
    result = []
    while num > 0:
        num, rem = divmod(num - 1, 26)
        result.append(chr(65 + rem))
    return ''.join(reversed(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.

Cite this entry

@misc{vaitp:cve2026103000,
  title        = {{Memory exhaustion via overly long PDF page-label strings (pre‑6.19.0).}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-103000},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-103000/}}
}

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.