CVE-2026-119206
Excessive CPU usage retrieving page labels from crafted PDFs (pre‑6.21.3).
- CVSS 7.1
- CWE-400
- Resource Management
- Remote
pypdf is a free and open-source pure-python PDF library. Prior to 6.21.3, pypdf can take excessive time to retrieve page labels from a crafted PDF containing a flat page-label number tree with many ranges. The page_labels property resolves each page independently and repeatedly scans the same /Nums array from the beginning, causing work to grow with both the page count and the number of label ranges. This issue is fixed in version 6.21.3.
- CWE
- CWE-400
- CVSS base score
- 7.1
- Published
- 2026-10-29
- OWASP
- A04 Insecure Design
- Orthogonal defect classification
- Algorithm
- Code defect classification
- Incorrect Algorithm
- Category
- Resource Management
- Subcategory
- Resource Exhaustion
- Accessibility scope
- Remote
- Impact
- Denial of Service (DoS)
- Affected component
- pypdf
- Fixed by upgrading
- Yes
Solution
Upgrade pypdf to version 6.21.3 or later.
Vulnerable code sample
from pypdf import PdfReader
def extract_labels(pdf_path):
reader = PdfReader(pdf_path)
labels = []
# VULNERABLE: repeatedly resolves page labels, causing O(n*m) work
for i in range(len(reader.pages)):
labels.append(reader.page_labels[i])
return labelsPatched code sample
from pypdf import PdfReader
def extract_labels(pdf_path):
reader = PdfReader(pdf_path)
# FIX: resolve page labels once and reuse the list
all_labels = list(reader.page_labels)
labels = []
for i in range(len(reader.pages)):
labels.append(all_labels[i])
return labelsPublished fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- PI: Read flat page label number trees once for all pages (#4251) (py-pdf/pypdf)
pypdf/_doc_common.py,pypdf/_doc_common.py · PdfDocCommon.page_labels,pypdf/_page_labels.py
Cite this entry
@misc{vaitp:cve2026119206,
title = {{Excessive CPU usage retrieving page labels from crafted PDFs (pre‑6.21.3).}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-119206},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-119206/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
