VAITP Dataset

← Back to the dataset

CVE-2026-102998

Excessive runtime due to looping in appearance-stream generation (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 with form field values can cause pypdf/generic/_appearance_stream.py appearance-stream generation to repeat invariant selection-data work inside a loop when an application updates fields with flattening enabled, resulting in excessive runtimes and application unavailability. This issue is fixed in version 6.19.0.

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

Solution

Upgrade pypdf to version 6.19.0 or later.

Vulnerable code sample

from pypdf.generic import DictionaryObject, NameObject, TextStringObject

def flatten_fields(pdf_writer, fields, flatten=True):
    """Update form field values and optionally flatten them."""
    for field in fields:
        # update field value
        field.update({NameObject("/V"): TextStringObject("example")})
        # VULNERABLE: repeated appearance generation inside loop causing exhaustion
        if flatten:
            # generate appearance stream for each field on every iteration
            appearance = DictionaryObject()
            appearance.update({
                NameObject("/Subtype"): NameObject("/Form"),
                NameObject("/BBox"): [0, 0, 100, 20],
                NameObject("/Resources"): DictionaryObject(),
                NameObject("/Length"): 0,
            })
            pdf_writer._addObject(appearance)  # simulate appearance insertion

Patched code sample

from pypdf.generic import DictionaryObject, NameObject, TextStringObject

def flatten_fields(pdf_writer, fields, flatten=True):
    """Update form field values and optionally flatten them."""
    for field in fields:
        # update field value
        field.update({NameObject("/V"): TextStringObject("example")})
        # FIX: generate appearance once per field, not repeatedly
        if flatten:
            appearance = DictionaryObject()
            appearance.update({
                NameObject("/Subtype"): NameObject("/Form"),
                NameObject("/BBox"): [0, 0, 100, 20],
                NameObject("/Resources"): DictionaryObject(),
                NameObject("/Length"): 0,
            })
            pdf_writer._addObject(appearance)  # simulate appearance insertion

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:cve2026102998,
  title        = {{Excessive runtime due to looping in appearance-stream generation (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-102998},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-102998/}}
}

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.