CVE-2026-113793
Infinite loop DOS on crafted cyclic PDF tree removal (pre‑6.20.1).
- CVSS 6.0
- CWE-835
- Resource Management
- Remote
pypdf is a free and open-source pure-python PDF library. Prior to 6.20.1, removing an object from a crafted cyclic PDF tree, such as an outline item, can enter an infinite loop and block the current process. This issue is fixed in version 6.20.1.
- CWE
- CWE-835
- CVSS base score
- 6.0
- Published
- 2026-10-21
- OWASP
- A06 Vulnerable and Outdated Components
- 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.20.1 or newer.
Vulnerable code sample
from pypdf import PdfReader, PdfWriter
def strip_outline(pdf_path: str, output_path: str):
reader = PdfReader(pdf_path)
writer = PdfWriter()
writer.append_pages_from_reader(reader)
# VULNERABLE: removing an outline item that participates in a cyclic outline tree can cause infinite loop
for outline in reader.outline:
if isinstance(outline, dict) and outline.get("/Title") == "DeleteMe":
writer.remove_outline_item(outline)
with open(output_path, "wb") as out_f:
writer.write(out_f)Patched code sample
from pypdf import PdfReader, PdfWriter
def strip_outline(pdf_path: str, output_path: str):
reader = PdfReader(pdf_path)
writer = PdfWriter()
writer.append_pages_from_reader(reader)
# FIX: break potential cycles before removal to avoid infinite loop
for outline in reader.outline:
if isinstance(outline, dict) and outline.get("/Title") == "DeleteMe":
outline["/Parent"] = None
writer.remove_outline_item(outline)
with open(output_path, "wb") as out_f:
writer.write(out_f)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.
- SEC: Prevent cyclic tree handling (#4188) (py-pdf/pypdf)
pypdf/generic/_data_structures.py · TreeObject.remove_child,pypdf/generic/_data_structures.py · TreeObject._remove_node_from_tree,pypdf/_writer.py · PdfWriter.find_outline_item
Cite this entry
@misc{vaitp:cve2026113793,
title = {{Infinite loop DOS on crafted cyclic PDF tree removal (pre‑6.20.1).}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-113793},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-113793/}}
}
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 ::
