Skip to main content
Vulnerability Database/CVE-2026-113793

CVE-2026-113793: pypdf Library DOS Vulnerability

CVE-2026-113793 is a denial of service vulnerability in pypdf that causes infinite loops when removing objects from cyclic PDF trees. This post covers technical details, affected versions, impact, and mitigation.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-113793 Overview

CVE-2026-113793 affects pypdf, a free and open-source pure-Python PDF library widely used for reading, writing, and manipulating PDF documents. The vulnerability exists in versions prior to 6.20.1. When pypdf attempts to remove an object from a crafted cyclic PDF tree, such as an outline item, the operation enters an infinite loop and blocks the current process. The flaw is categorized under CWE-835: Loop with Unreachable Exit Condition. Processing an attacker-supplied PDF is sufficient to trigger the condition, making any application that ingests untrusted PDFs through pypdf susceptible to denial of service.

Critical Impact

A crafted PDF with a cyclic outline tree causes pypdf to loop indefinitely, exhausting CPU and blocking the hosting process until manual intervention.

Affected Products

  • pypdf versions prior to 6.20.1
  • Python applications and services that import pypdf for PDF parsing or modification
  • Downstream libraries and workflows that pass untrusted PDF files through pypdf

Discovery Timeline

  • 2026-10-21 - CVE-2026-113793 published to the National Vulnerability Database
  • 2026-10-22 - Last updated in NVD database

Technical Details for CVE-2026-113793

Vulnerability Analysis

The vulnerability is a denial-of-service condition triggered during tree traversal inside pypdf. PDF documents represent structures such as outlines (bookmarks) as linked trees of indirect objects. pypdf's removal routines walk these trees using /First, /Next, and /Parent references. The traversal logic assumes an acyclic structure. When pypdf processes a PDF whose outline tree contains a cycle, the walker revisits the same nodes repeatedly and never reaches a termination condition. The result is unbounded CPU consumption on the thread performing the operation, blocking any synchronous caller.

Root Cause

The root cause is missing cycle detection in the outline tree traversal code within pypdf/_writer.py. The find_outline_item function iterated across sibling and child nodes without tracking which indirect references had already been visited. The fix in version 6.20.1 introduces a visited set keyed on object identity, allowing the traversal to detect and skip previously seen nodes.

Attack Vector

Exploitation requires an attacker to supply a crafted PDF that is subsequently processed by an application using a vulnerable pypdf version. User interaction is required to open or submit the file. Any server-side service that accepts PDF uploads, email gateways that parse attachments, or automated document pipelines constitute viable targets. No authentication or privilege is required when the service accepts anonymous PDF submissions.

python
    def find_outline_item(
        self,
-        outline_item: dict[str, Any],
+        outline_item: Union[IndirectObject, str],
        root: Optional[OutlineType] = None,
+        *,
+        visited: Optional[set[int]] = None,
    ) -> Optional[list[int]]:
        if root is None:
-            o = self.get_outline_root()
+            outline = self.get_outline_root()
        else:
-            o = cast("TreeObject", root)
+            outline = cast("TreeObject", root)
+        if visited is None:
+            visited = set()

-        i = 0
-        while o is not None:
+        index = 0
+        while outline is not None:
            if (
-                o.indirect_reference == outline_item
-                or o.get("/Title", None) == outline_item
+                outline.indirect_reference == outline_item
+                or outline.get("/Title", None) == outline_item
            ):
-                return [i]
-            if "/First" in o:

Source: pypdf commit c9c35b4. The patch introduces a visited set to break traversal when a cycle is detected.

Detection Methods for CVE-2026-113793

Indicators of Compromise

  • A Python process using pypdf consuming 100% of a CPU core for an extended period with no progress or output
  • Request timeouts or thread starvation in services that invoke pypdf's outline manipulation functions
  • PDF files whose outline tree contains self-referential or circular /First, /Next, or /Parent entries

Detection Strategies

  • Inventory Python environments and container images for pypdf installations below version 6.20.1 using pip list or software composition analysis
  • Enable per-request CPU and wall-clock timeouts on PDF processing workers to surface runaway tasks
  • Review application logs for repeated worker restarts or watchdog kills correlated with PDF ingestion

Monitoring Recommendations

  • Alert on sustained high CPU utilization by Python workers handling user-supplied PDFs
  • Track the dependency version of pypdf in CI pipelines and fail builds that resolve a vulnerable version
  • Capture and quarantine PDF inputs that trigger timeouts for offline inspection

How to Mitigate CVE-2026-113793

Immediate Actions Required

  • Upgrade pypdf to version 6.20.1 or later in all production, staging, and developer environments
  • Rebuild and redeploy container images that embed pypdf as a transitive dependency
  • Enforce execution timeouts on any code path that invokes pypdf against untrusted input

Patch Information

The fix is included in pypdf 6.20.1, delivered through pull request #4188 and commit c9c35b4. The patch adds a visited set to find_outline_item and related traversal routines so that cyclic trees terminate instead of looping. Refer to GHSA-9mx8-4j7g-633p for the full advisory.

Workarounds

  • Isolate PDF parsing in a subprocess with a hard CPU and wall-clock limit so a looping worker can be reaped without affecting the parent service
  • Reject PDFs that fail structural validation checks for outline trees before passing them to pypdf
  • Restrict PDF ingestion to authenticated users and apply rate limiting until the upgrade can be deployed
bash
# Upgrade pypdf to the patched release
pip install --upgrade "pypdf>=6.20.1"

# Verify the installed version
python -c "import pypdf; print(pypdf.__version__)"

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.