Skip to main content

pypdf EUVDEUVD-2026-38354

| CVE-2026-54530 MEDIUM
Loop with Unreachable Exit Condition (Infinite Loop) (CWE-835)
2026-06-16 https://github.com/py-pdf/pypdf GHSA-52x6-gq3r-vpf4
6.9
CVSS 4.0 · Vendor: https://github.com/py-pdf/pypdf
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Craft PDF with circular /Parent reference
  2. Delivery
    Submit PDF to target service
  3. Exploit
    Application calls layout-mode text extraction
  4. Execution
    _layout_mode_fonts() enters infinite loop
  5. Persist
    Worker process hangs indefinitely
  6. Impact
    Service availability degraded or lost

Vulnerability Assessment

Weakness
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Loop termination conditions
MITRE ATT&CK

1 technique across 1 tactic: Impact

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires two conditions: (1) the target application must be using pypdf < 6.13.0 and must invoke text extraction with layout mode enabled (specifically the code path through _layout_mode_fonts() - triggered by extraction_mode='layout' or equivalent); (2) the attacker must be able to supply a PDF file that the application will process, either directly (file upload endpoint) or indirectly (e.g., emailing a document to an ingestion pipeline). Exploitation is limited to denial of service - there is no code execution, data disclosure, or privilege escalation vector. Applications that use pypdf only for non-layout extraction, metadata reading, or merging are not affected by this specific vulnerability. The vulnerable traversal only activates when font resources are resolved during layout rendering.

Impact

Real-world risk is moderate for services that accept untrusted PDF uploads and process them with layout-mode text extraction. The CVSS score is officially not assigned, but the attack requires no authentication, no special privileges, and only that the victim application invoke extract_text(extraction_mode='layout') on the malicious file - a very common usage pattern in document-processing pipelines, OCR services, and data-ingestion tools. There is no confidentiality or integrity impact; the sole effect is application hang (Availability: High). The attack is not automatable at scale in the sense of unaided propagation - a human or automated pipeline must ingest the PDF - but in web applications with file-upload endpoints, an unauthenticated attacker can repeatedly trigger the loop, potentially exhausting worker processes. No EPSS data is available. No KEV listing and no public POC have been identified, suggesting exploitation risk is currently theoretical rather than observed.

Exploit ScenarioDerived

An attacker submits a crafted PDF to a document-processing web service that uses pypdf with layout-mode text extraction (e.g., a resume parser or invoice OCR endpoint). The PDF contains a circular /Parent chain in its page object tree. When the service calls page.extract_text(extraction_mode='layout'), _layout_mode_fonts() enters an infinite loop, hanging the worker process indefinitely. Repeated submissions exhaust the application's worker pool, causing a full denial of service. No public proof-of-concept exploit code has been identified, but the fix's own test case (test_page_object__layout_mode_fonts__cyclic) demonstrates the exact construction needed.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.1% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jun 16, 2026

Infinite loop denial-of-service in pypdf allows an attacker to hang any Python application that processes a crafted PDF using layout-mode text extraction. The vulnerability arises because the /Parent hierarchy traversal in _layout_mode_fonts() lacked cycle detection, so a circular reference structure in a malicious PDF causes the parser to loop indefinitely. No active exploitation is confirmed (not in CISA KEV) and no public exploit code has been identified, but the attack surface is broad: any service accepting user-supplied PDFs and passing them to pypdf's layout-mode extraction is potentially affected.

RemediationAI

The primary fix is to upgrade pypdf to version 6.13.0 or later via pip install --upgrade 'pypdf>=6.13.0'. The release is available at https://github.com/py-pdf/pypdf/releases/tag/6.13.0. For environments where an immediate upgrade is not possible, the changes in PR #3830 (https://github.com/py-pdf/pypdf/pull/3830) can be applied as a manual patch to pypdf/_page.py and pypdf/_writer.py. As a compensating control without code changes, operators can disable layout-mode text extraction and fall back to the default extraction mode, which does not trigger the vulnerable traversal; this trades layout fidelity for safety. Additionally, enforcing a per-process CPU or wall-clock timeout (e.g., via signal.alarm on Linux or a subprocess watchdog) limits the blast radius of any infinite loop, at the cost of aborting legitimate long-running extractions. Restricting PDF upload endpoints to authenticated users reduces the unauthenticated attack surface but does not eliminate risk from malicious insiders or compromised accounts.

Affected VersionsENISA

pypdf < 6.13.0

Affected Packages

pypi pypdf fix: 6.13.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in pypi

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

pypdf (pip package pypdf, formerly PyPDF2) is a pure-Python PDF manipulation library. The affected code path is pypdf/_page.py::_layout_mode_fonts(), which traverses the PDF page object tree via /Parent references to collect font resources for layout-mode text rendering. The PDF specification permits a tree of page dictionaries linked by /Parent pointers, but it does not inherently prevent circular references in a malformed or malicious file. Prior to the fix, the traversal loop had no visited-node tracking, so a crafted PDF embedding a cycle (e.g., page → dict2 → dict3 → page) would spin forever. The same pattern existed in _writer.py::_get_filtered_outline() for outline (bookmark) trees. The root cause is classified as CWE-835 (Loop with Unreachable Exit Condition / Infinite Loop). The fix in PR #3830 introduces a visited: set[int] guard using Python object identity (id()) to detect and break cycles, emitting a warning rather than raising an exception.

Know when the next one hits your stack

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/py-pdf/pypdf) PRIMARY 6.9 MEDIUM
CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
vuln.today AI 6.5 MEDIUM

Network-deliverable crafted PDF requires no privileges; user/service interaction (UI:R) needed to process the file; pure availability impact from infinite loop.

3.1 AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H
4.0 AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
SUSE MEDIUM
Red Hat 5.9 MEDIUM

Primary rating from Vendor (https://github.com/py-pdf/pypdf).

CVSS VectorVendor: https://github.com/py-pdf/pypdf

Attack Vector
Local
Attack Complexity
Low
Attack Requirements
None
Privileges Required
None
User Interaction
None
Vulnerable system: Confidentiality
None
Vulnerable system: Integrity
None
Vulnerable system: Availability
High
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

Lifecycle Timeline

1
CVSS changed
Jun 22, 2026 - 21:39 NVD
6.9 (MEDIUM)

DescriptionCVE.org

Impact

An attacker who uses this vulnerability can craft a PDF which leads to an infinite loop. This requires extracting the text in layout mode.

Patches

This has been fixed in pypdf==6.13.0.

Workarounds

If you cannot upgrade yet, consider applying the changes from PR #3830.

Blast Radius

ecosystem impact
† from your stack dependencies † transitive graph · vuln.today resolves 4-path depth
  • 1 pypi packages depend on pypdf (1 direct, 0 indirect)

Ecosystem-wide dependent count for version 6.13.0.

Threat Intelligence Overview

EPSS Score
0.1%
Top 97% exploitable
Threat Intel
1
1 source
Data Quality
8 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment GHSA Vendor GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.1%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Defer
Exploitation
None
System Exposure· derived
Small
Automatable
No
Human Impact· derived
Medium
Technical Impact
Partial

Priority Score

34
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +34
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Denial of Service attacks render applications or systems unavailable by overwhelming resources or triggering failure conditions.

Vendor StatusVendor

SUSE

Severity: Moderate

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy