CVE-2026-41313: 
Python vulnerability analysis and mitigation

Overview

CVE-2026-41313 is a denial-of-service vulnerability in pypdf, a free and open-source pure-Python PDF library, caused by excessive iteration when processing a crafted PDF with a large trailer /Size value in incremental mode. It affects all pypdf versions prior to 6.10.2 and was disclosed on April 22, 2026, with the fix released on April 15, 2026. The vulnerability carries a CVSS v3.1 base score of 6.5 (Medium) and a CVSS v4.0 base score of 4.8 (Medium) (GitHub Advisory, Feedly).

Technical details

The root cause is classified as CWE-834 (Excessive Iteration): the vulnerable code in PdfWriter.clone_reader_document_root() unconditionally trusted the trailer's /Size field to allocate and iterate over objects during incremental cloning, without enforcing any upper bound on the value. Specifically, the pre-patch code executed self._objects = [None] * (cast(int, reader.trailer["/Size"]) - 1) followed by a loop over all indices, meaning a crafted PDF with an arbitrarily large /Size (e.g., 5,000,000) would cause the library to allocate a massive list and iterate over it, consuming significant CPU and memory. The fix in PR #3735 replaces this logic with _collect_incremental_clone_object_ids(), which enumerates only actual object IDs from the xref table and enforces configurable limits (incremental_clone_object_count_limit defaulting to 500,000 and incremental_clone_object_id_limit defaulting to 1,000,000) (GitHub PR, GitHub Commit).

Impact

Successful exploitation causes a denial-of-service condition: an application using a vulnerable version of pypdf to process attacker-supplied PDFs will experience severely degraded performance or become unresponsive due to excessive CPU and memory consumption. There is no impact on confidentiality or integrity — only availability is affected. Any service or pipeline that accepts and processes user-provided PDF files (e.g., document management systems, web upload handlers) is at risk of becoming unavailable to legitimate users (GitHub Advisory, Feedly).

Exploitability

No public proof-of-concept exploit code has been identified, and there is no evidence of in-the-wild exploitation at this time. The EPSS score is approximately 0.014% (0.000140), indicating a very low probability of exploitation in the near term. The vulnerability is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog. Exploitation requires user interaction — specifically, an application must load the malicious PDF — but no authentication or special privileges are needed on the attacker's side (Feedly, GitHub Advisory).

Exploitation steps

  1. Craft malicious PDF: Create a minimal valid PDF file containing only a few real objects (e.g., a catalog, pages, and one page object) but set the trailer /Size field to an extremely large value (e.g., /Size 5000000) in the trailer dictionary.
  2. Deliver the PDF: Submit the crafted PDF to a target application or service that uses a vulnerable version of pypdf (< 6.10.2) to process PDFs in incremental mode — for example, via a file upload endpoint, email attachment processor, or document conversion service.
  3. Trigger incremental loading: Ensure the application invokes PdfWriter with incremental=True or calls clone_reader_document_root() on the malicious PDF, which causes pypdf to read the inflated /Size value from the trailer.
  4. Exhaust resources: The vulnerable code allocates a list of None values sized to /Size - 1 and iterates over all indices, consuming large amounts of memory and CPU time, causing the application to hang or become unresponsive (GitHub PR, GitHub Advisory).

Indicators of compromise

  • Process Behavior: Python processes consuming abnormally high CPU or memory when processing PDF files; processes hanging indefinitely without completing PDF parsing tasks.
  • Logs: Application logs showing timeouts or unresponsiveness correlated with PDF processing operations; errors such as LimitReachedError (post-patch) indicating attempted exploitation against patched systems.
  • File System: Presence of PDF files with unusually large trailer /Size values (e.g., in the millions) that do not correspond to the actual number of objects in the file; these can be identified by inspecting the trailer dictionary near the end of the PDF file for a /Size entry disproportionate to the file size.

Mitigation and workarounds

Upgrade pypdf to version 6.10.2 or later, which introduces object count and object ID limits for incremental cloning (defaulting to 500,000 and 1,000,000 respectively) and no longer trusts the trailer /Size value blindly (GitHub Release). If an immediate upgrade is not possible, manually apply the changes from PR #3735 to the local pypdf installation (GitHub PR). As an additional defense-in-depth measure, restrict PDF processing to trusted sources only and consider implementing pre-processing validation to reject PDFs with trailer /Size values that are disproportionately large relative to the file size.

Community reactions

The vulnerability was reported by researcher l3b4nk4 and analyzed and patched by pypdf maintainer stefan6419846, who published the security advisory and merged the fix on April 15, 2026 (GitHub Advisory). The NixOS/nixpkgs project tracked the issue and opened a corresponding update ticket (NixOS/nixpkgs#512719), indicating prompt uptake in downstream distributions. No significant broader media coverage or notable social media discussion has been identified beyond standard vulnerability aggregator listings.

Additional resources

Linux Distribution fix status

Fix availability across major Linux distributions and their releases.

Debian

Fixed

bookworm

pypdf2

Affected

sid

pypdf: 6.19.0-1

Fixed

trixie

pypdf

Affected

Ubuntu

Unknown

bionic (esm-apps)

pypdf2

Unknown

devel

pypdf

Unknown

focal (esm-apps)

pypdf2

Unknown

jammy

pypdf2

Unknown

jammy (esm-apps)

pypdf2

Unknown

noble

pypdf

Unknown

noble (esm-apps)

pypdf

Unknown

resolute

pypdf

Unknown

RHEL / CentOS

Unknown

Source: This report was generated using AI

Related Python vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

GHSA-3r6w-7pcg-c4x2HIGH7.5
  • Python logoPython
  • ag2
NoYesNov 22, 2026
GHSA-xx4q-fj82-qjp5MEDIUM6.5
  • Python logoPython
  • libp2p
NoNoNov 22, 2026
GHSA-224h-jmfq-qc67MEDIUM5.9
  • Python logoPython
  • ag2
NoYesNov 22, 2026
GHSA-8r36-g3rm-mf85MEDIUMN/A
  • Python logoPython
  • pymaxim
NoYesNov 22, 2026
GHSA-7xgg-5cm6-g46fMEDIUMN/A
  • Python logoPython
  • pymaxim
NoYesNov 22, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Additional Wiz resources

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management