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-113794 Overview
CVE-2026-113794 is a denial-of-service vulnerability in pypdf, a widely used pure-Python PDF library. Versions prior to 6.20.0 mishandle a truncated PDF file that terminates inside a standard cross-reference (xref) table. An attacker can craft an incomplete PDF that forces the parser into an infinite loop, consuming CPU resources and stalling the host application. The flaw is tracked under CWE-835: Loop with Unreachable Exit Condition and is fixed in pypdf6.20.0.
Critical Impact
A single malformed PDF submitted to any service that parses untrusted documents with pypdf can hang a worker process indefinitely, degrading availability of document-processing pipelines.
Affected Products
- pypdf versions prior to 6.20.0
- Python applications and services that process untrusted PDF input using vulnerable pypdf releases
- Downstream libraries and ETL pipelines that embed pypdf as a parsing dependency
Discovery Timeline
- 2026-10-21 - CVE-2026-113794 published to NVD
- 2026-10-22 - Last updated in NVD database
- Fix released - pypdf6.20.0 published via GitHub Release 6.20.0 with details in GHSA-39mj-jf6j-2qj3
Technical Details for CVE-2026-113794
Vulnerability Analysis
The vulnerability lives in the standard cross-reference table parser inside pypdf/_reader.py. When pypdf reads an xref table, it walks backward through the stream searching for the end of the previous line by seeking in 20-byte windows. If the file is truncated inside the xref table, the backward read returns fewer than 20 bytes, but the loop still inspects line[0] and reseeks. The exit condition is never satisfied, which creates a non-terminating loop as described in [CWE-835]. The result is CPU exhaustion in the parsing thread or worker.
This class of flaw is a resource-exhaustion denial of service. It does not corrupt memory, leak data, or allow code execution. The practical risk is highest in multi-tenant services that accept user-uploaded PDFs, such as e-signature platforms, mail gateways, and document search indexers.
Root Cause
The parser assumed that stream.read(20) always returned 20 bytes. When the PDF ends mid-xref, the read is short, control flow never breaks out of the while loop, and the seek pointer oscillates around the end of file.
Attack Vector
Exploitation requires an attacker to deliver a crafted PDF to any component that invokes pypdf on untrusted input. The attack is network reachable (AV:N) and requires user or application interaction to open the document, but no authentication. The patched version adds an explicit short-read check that raises PdfReadError:
while line[0] in b"\\x0D\\x0A":
stream.seek(-20 + 1, 1)
line = stream.read(20)
+ if len(line) != 20:
+ raise PdfReadError("Unexpected EOF in Xref table.")
# On the other hand, some malformed PDF files
# use a single character EOL without a preceding
Source: py-pdf/pypdf commit 37e1cd6
Detection Methods for CVE-2026-113794
Indicators of Compromise
- Python worker processes stuck at or near 100% CPU with stack frames inside pypdf/_reader.py xref parsing routines
- PDF upload or ingestion requests that never return a response and eventually hit application timeouts
- Repeated submissions of small, truncated PDF files from the same source address or tenant
Detection Strategies
- Inventory Python environments and container images for pypdf versions below 6.20.0 using pip list or Software Bill of Materials (SBOM) scanning
- Add per-request CPU and wall-clock budgets to PDF-processing endpoints and alert on sustained budget violations
- Enable Python fault handlers or periodic thread dumps so hung workers can be attributed to pypdf xref parsing frames
Monitoring Recommendations
- Track process-level CPU time and runtime for any job that invokes pypdf, alerting when a single document exceeds expected parse duration
- Log file size and SHA-256 of PDFs that trigger worker timeouts to support correlation and blocklisting
- Monitor dependency manifests in CI for pinned versions of pypdf and fail builds on vulnerable ranges
How to Mitigate CVE-2026-113794
Immediate Actions Required
- Upgrade pypdf to 6.20.0 or later in all applications, container images, and serverless functions
- Audit transitive dependencies, since libraries such as PDF text extractors and OCR pre-processors frequently vendor pypdf
- Enforce execution timeouts on any code path that calls PdfReader on untrusted input until the upgrade is verified
Patch Information
The upstream fix is included in pypdf 6.20.0 and merged via pull request #4170, which resolves issue #4169. The advisory is published as GHSA-39mj-jf6j-2qj3.
Workarounds
- Wrap pypdf calls in a subprocess or worker with a hard wall-clock timeout, terminating any job that exceeds a safe threshold
- Pre-validate PDF structure before parsing by checking that the file ends with a well-formed %%EOF marker and complete xref section
- Rate limit and size limit PDF uploads from untrusted sources to reduce the amplification potential of malicious documents
# Upgrade pypdf to the fixed release
pip install --upgrade "pypdf>=6.20.0"
# 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

