Skip to main content

pypdf EUVDEUVD-2026-38358

| CVE-2026-54651 MEDIUM
Loop with Unreachable Exit Condition (Infinite Loop) (CWE-835)
2026-06-22 GitHub_M GHSA-g9xf-7f8q-9mcj
6.9
CVSS 4.0 · Vendor: GitHub_M
View

Attack ChainAIDerived

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

  1. Access
    Craft PDF with cyclic article bead chain (/N pointer loop)
  2. Delivery
    Deliver crafted PDF to merge-enabled pypdf application
  3. Exploit
    Application calls PdfWriter merge, invoking _add_articles_thread
  4. Execution
    Method traverses cyclic linked list without exit condition
  5. Persist
    Worker process enters infinite loop, consuming CPU
  6. Impact
    Application thread/process becomes unresponsive (DoS)

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 concurrent conditions: (1) the target application must invoke pypdf's PDF merge functionality - specifically a code path that calls _add_articles_thread(), triggered when the source PDF's document catalog contains a /Threads array with at least one thread entry; and (2) the attacker must control or influence one of the PDFs being merged to supply a crafted file. Applications that only read, split, or render PDFs without merging are not affected. PDFs lacking a /Threads entry are also safe regardless of merge usage. Exploitation does not require authentication on the host system (the attacker need only deliver the file), but the attacker cannot exploit this without the victim application performing the merge operation. No special platform, OS, or Python version is required - any environment running pypdf < 6.13.1 with merge functionality is equally vulnerable.

Impact

The CVSS 4.0 score of 6.9 (Medium) with vector AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H accurately reflects that the impact is limited to availability (process hang) with no confidentiality or integrity consequences. The AV:L designation is appropriate because pypdf processes files on the local system, though in practice many deployments accept PDFs from network-facing upload endpoints, effectively elevating the realistic attack surface beyond a strict local interpretation. No EPSS score was provided in the input data, and there is no CISA KEV listing, indicating no confirmed widespread exploitation. However, the PR #3839 diff is publicly available and includes a working test case that explicitly constructs a cyclic article chain (article3['/N'] = reference3 self-loop), meaning a working trigger is effectively disclosed. The technical impact is a hung worker process or thread, which in single-process or resource-constrained deployments can equate to a full service outage. The risk is most acute for applications that automatically merge untrusted user-supplied PDFs without input validation or timeout enforcement.

Exploit ScenarioDerived

An attacker submits a crafted PDF to a web application or batch pipeline that uses pypdf to merge user-supplied documents - for example, a document management system or report generator. The PDF contains three article bead dictionaries where the last bead's /N pointer references itself or an earlier bead, forming a cycle. When the application calls PdfWriter.merge() or internally invokes _add_articles_thread(), the method traverses the bead chain indefinitely, pinning the worker process at 100% CPU until the OS or a watchdog forcibly kills it, causing a denial-of-service for that request slot.

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 22, 2026

Infinite loop denial-of-service in pypdf prior to 6.13.1 allows an attacker to hang any process that merges a crafted PDF containing cyclic article/thread structures. The vulnerability exists in the _add_articles_thread() method of _writer.py, which traversed PDF article bead linked-list structures without cycle detection, permitting a self-referential /N (Next) pointer chain to create an irrecoverable loop. No public exploit code or CISA KEV listing exists at time of analysis, but the upstream PR diff publicly discloses the precise triggering structure, lowering the bar for exploitation against vulnerable merge pipelines.

RemediationAI

Upgrade pypdf to version 6.13.1 or later, available via PyPI (pip install --upgrade pypdf) and documented at https://github.com/py-pdf/pypdf/releases/tag/6.13.1. If an immediate upgrade is not feasible, the most actionable compensating control is to wrap all PdfWriter.merge() calls (or equivalent) in a subprocess or thread with a strict wall-clock timeout and kill the worker if it exceeds an expected processing duration - this bounds the DoS impact to a single request rather than a persistent hang. Alternatively, pre-screen incoming PDFs to detect the presence of /Threads entries in the document catalog before merging; rejecting or stripping thread structures from untrusted inputs eliminates the vulnerable code path entirely, though it may affect legitimate article-threaded documents. Do not rely on file size limits alone, as the cyclic structure is compact and size-based filters will not detect it.

Affected VersionsENISA

pypdf < 6.13.1

Affected Packages

pypi pypdf fix: 6.13.1

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 (CPE: cpe:2.3:a:py-pdf:pypdf) is a pure-Python library for reading, writing, and merging PDF files. The PDF specification supports 'articles' - named reading sequences composed of linked 'bead' dictionaries connected via /N (Next) and /P (Previous) pointers. The _add_articles_thread() method in pypdf/_writer.py iterated through these bead dictionaries following /N pointers to clone and register each article during a merge operation. The method contained no visited-node tracking, embodying CWE-835 (Loop with Unreachable Exit Condition): a crafted PDF where the last bead's /N pointer references an earlier bead creates a circular linked list that the traversal loop can never exit. The fix (PR #3839) introduces a visited: set[int] tracking id(current_article) and raises LimitReachedError upon detecting a revisited node.

Know when Pypdf gets its next vulnerability

  • 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 (GitHub_M) 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.2 MEDIUM

Attacker delivers a crafted file processed locally by pypdf with no required privileges or separate user interaction; only availability is impacted via process hang.

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

Primary rating from Vendor (GitHub_M).

CVSS VectorVendor: GitHub_M

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
Patch available
Jun 22, 2026 - 22:02 EUVD

DescriptionCVE.org

pypdf is a free and open-source pure-python PDF library. Prior to 6.13.1, an attacker who uses this vulnerability can craft a PDF which leads to an infinite loop. This requires merging a file with threads/articles into a writer. This vulnerability is fixed in 6.13.1.

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.1.

Threat Intelligence Overview

EPSS Score
0.1%
Top 97% exploitable
Prevalence
Medium
widely-used Python PDF library across data engineering and document pipelines
Threat Intel
1
1 sources
Exploit
POC
Public exploit code exists
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 Yes
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

54
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +34
PoC: +20
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.

More in Pypdf

View all
CVE-2026-84309 MEDIUM POC
6.9 Sep 01

Infinite loop denial of service in pypdf prior to 6.16.0 allows any attacker who can supply a crafted PDF to a pypdf-bas

CVE-2023-36810 MEDIUM POC
6.5 Jun 30

pypdf is a pure-python PDF library capable of splitting, merging, cropping, and transforming the pages of PDF files. Rat

CVE-2023-36807 MEDIUM POC
6.5 Jun 30

pypdf is a pure-python PDF library capable of splitting, merging, cropping, and transforming the pages of PDF files. Rat

CVE-2023-36464 MEDIUM POC
5.5 Jun 27

pypdf is an open source, pure-python PDF library. Rated medium severity (CVSS 5.5), this vulnerability is no authenticat

CVE-2026-84310 MEDIUM POC
4.8 Sep 01

Resource exhaustion in pypdf prior to 6.16.1 allows an attacker who can supply a crafted PDF to cause denial of service

CVE-2026-103000 HIGH
8.7 Sep 30

Memory exhaustion in pypdf versions prior to 6.19.0 allows a remote, unauthenticated attacker to make an application una

CVE-2026-102999 HIGH
8.7 Sep 30

Denial of service in pypdf versions prior to 6.19.0 allows an unauthenticated remote attacker to pin a PDF-processing wo

CVE-2026-102998 HIGH
8.7 Sep 30

Denial of service in pypdf versions prior to 6.19.0 allows remote, unauthenticated attackers to exhaust application CPU

CVE-2026-102997 HIGH
8.7 Sep 30

Denial of service in pypdf before 6.18.1 lets a crafted PDF drive the library's FlateDecode recovery path into inefficie

CVE-2026-102996 HIGH
8.7 Sep 30

Memory exhaustion in pypdf versions prior to 6.18.1 lets a crafted PDF force the library to allocate and process far mor

CVE-2026-102995 HIGH
8.7 Sep 30

Memory exhaustion in pypdf versions prior to 6.18.1 allows unauthenticated remote attackers to crash or degrade any appl

CVE-2026-102994 HIGH
8.7 Sep 30

Denial of service in pypdf versions prior to 6.18.0 allows remote, unauthenticated attackers to stall PDF parsing by sup

Vendor StatusVendor

SUSE

Severity: Moderate
Product Status
openSUSE Tumbleweed Fixed

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