CVE-2026-54651: pypdf Infinite Loop Denial of Service Vulnerability
pypdf, a widely-used Python library for PDF manipulation, contains a flaw that allows an attacker to craft a malicious PDF file capable of triggering an infinite loop when that file is merged with other PDFs in a writer operation. The vulnerability specifically occurs when processing PDFs containing threads or articles during a merge operation. An attacker with local access could exploit this to cause a denial of service by exhausting system resources and making applications using the library unresponsive. The issue has been patched in version 6.13.1.
Source data · NVD / CISA · public domain
- CVSS
- 3.1 · 5.5 MEDIUM · CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
- Weaknesses (CWE)
- CWE-835
- Affected products
- 1 configuration(s)
- Published / Modified
- 2026-06-22 / 2026-06-24
NVD description (verbatim)
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.
3 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
CVE-2026-54651 is an infinite loop vulnerability (CWE-835) in pypdf prior to version 6.13.1. The flaw is triggered during PDF merge operations when a crafted input file containing threads or articles is processed by the library's writer functionality. The attack vector is local, requires low complexity, and demands low privilege level. The vulnerability results in availability impact through resource exhaustion via uncontrolled looping logic. No authentication, user interaction, or elevated privileges are needed to trigger the denial of service once an attacker-controlled PDF reaches the vulnerable code path.
Business impact
Applications relying on pypdf for automated PDF processing—including document management systems, report generators, and content workflow tools—face service disruption risk. If pypdf runs in a shared or cloud environment, a single malicious PDF could consume CPU resources and degrade service for other users or applications. For organizations processing untrusted PDF inputs (customer uploads, third-party documents), this vulnerability creates an easy path to denial of service without requiring network access or credentials. Recovery typically requires service restart, resulting in downtime and operational disruption.
Affected systems
Any system running pypdf versions prior to 6.13.1 is affected. The vulnerability is restricted to merge operations involving files with threads or articles, so not all PDF processing workflows trigger the flaw. Developers and organizations using pypdf in production, particularly those processing documents from untrusted or external sources, should prioritize upgrade assessment. The pure-Python nature of the library means it runs across all major operating systems where Python is available.
Exploitability
Exploitation requires local access and the ability to supply a crafted PDF file to an application using pypdf. The attack is not network-remotely exploitable and does not require special privileges or user interaction beyond normal file processing. The barrier to exploitation is low: an attacker simply needs to craft a PDF with specific structural characteristics (threads or articles) and ensure it reaches the vulnerable merge function. Proof-of-concept creation would be straightforward for someone familiar with PDF structure, making weaponization likely once details are disclosed.
Remediation
Upgrade pypdf to version 6.13.1 or later immediately. Verify the upgrade in your dependency management tool (pip, poetry, requirements.txt, etc.) and redeploy affected services. For organizations unable to patch immediately, implement input validation and sandboxing: reject PDFs from untrusted sources, isolate PDF processing in separate processes or containers, and set strict CPU/memory limits on processing tasks. Monitor resource consumption on services using pypdf as a temporary warning indicator.
Patch guidance
Update pypdf using your package manager: run `pip install --upgrade pypdf>=6.13.1` or update your requirements file and reinstall dependencies. Verify the installed version with `pip show pypdf`. Test the update in a staging environment before production deployment to ensure no compatibility issues with your application's PDF merge operations. Review any custom merge logic in your codebase to confirm it will benefit from the patched library behavior. No configuration changes are required; the fix is transparent upon upgrade.
Detection guidance
Monitor for signs of resource exhaustion during PDF processing: sustained high CPU usage on threads handling PDF merges, excessive memory allocation, or process hangs without corresponding network traffic or disk I/O. Check application logs for timeouts or incomplete merge operations. If you run pypdf in production, log the library version at startup and alert on mismatches. For threat hunting, identify all inbound or uploaded PDFs processed within a time window and correlate with performance degradation events. Examine the PDF metadata and structure of any file that preceded a performance incident to look for suspicious thread or article elements.
Why prioritize this
This vulnerability scores MEDIUM (5.5 CVSS) due to local-only access requirement and availability-only impact, but warrants relatively high prioritization for organizations processing external PDFs. The vulnerability is not yet listed in CISA's Known Exploited Vulnerabilities (KEV) catalog, but the simplicity of exploitation and straightforward patch path argue for timely remediation. Prioritize based on whether your organization accepts untrusted PDF inputs; if you do, treat this as a near-term fix. For internal-only PDF processing, a standard quarterly patching cycle is acceptable.
Risk score, explained
CVSS 3.1 score of 5.5 (MEDIUM) reflects that exploitation requires local access (AV:L) and low complexity (AC:L), demands only low privileges (PR:L), needs no user interaction (UI:N), and impacts only availability (A:H) within a single security boundary (S:U). The score does not account for business context; organizations processing high volumes of untrusted PDFs face greater practical risk than the base score suggests. The absence of confidentiality or integrity impact prevents a higher severity rating, but the denial-of-service impact remains operationally significant.
Frequently asked questions
Can this vulnerability be exploited over the network?
No. The attack vector is local (AV:L), meaning the attacker must already have access to the system or be able to place a file on it. Remote exploitation via malicious PDF URLs is not possible; the vulnerability requires the crafted PDF to be merged by an application running pypdf on the local system.
Do all PDFs trigger this vulnerability, or only specific ones?
Only PDFs containing threads or articles that are merged into a writer will trigger the infinite loop. Standard PDFs without these structural elements are not affected. This means not all PDF processing workflows are impacted, but any application that merges external or untrusted PDFs should be considered at risk.
What happens if a malicious PDF reaches the vulnerable code?
The library enters an infinite loop during the merge operation, consuming CPU resources indefinitely until the process is killed or times out. This causes the application or service to become unresponsive, disrupting PDF processing for all users or requests. No data is corrupted or stolen, but service availability is lost.
Is there a workaround if I cannot patch immediately?
Yes. Implement strict input validation to reject PDFs from untrusted sources, run PDF processing in isolated processes or containers with CPU and memory limits, set operation timeouts, and monitor resource consumption. These defenses reduce risk while you prepare for an upgrade. However, patching remains the proper solution.
This analysis is provided for informational purposes and represents the state of information as of the published date. SEC.co makes no warranty regarding the completeness or accuracy of third-party vulnerability data. Organizations should verify patch version numbers, affected product lists, and remediation steps against official vendor advisories before deploying changes. Timelines, severity assessments, and exploitability determinations may evolve as new information emerges. Consult your security team and vendor documentation when planning response actions. Source: NVD (public-domain), retrieved 2026-07-28. Analysis generated by SEC.co (claude-haiku-4-5).
Related vulnerabilities
- CVE-2026-54530MEDIUMpypdf Infinite Loop DoS Vulnerability – Patch to 6.13.0
- CVE-2026-54531MEDIUMpypdf Infinite Loop DoS Vulnerability – Patch to 6.13.0
- CVE-2026-10028MEDIUMglib-networking GnuTLS Certificate Validation Denial-of-Service
- CVE-2026-41150MEDIUMMermaid Gantt Chart DoS via Excludes Attribute
- CVE-2026-44740MEDIUMBilly Go Library Denial-of-Service via Input Validation Flaws
- CVE-2026-46146MEDIUMLinux Kernel USB Audio Infinite Loop DoS Vulnerability
- CVE-2026-46314MEDIUMLinux Kernel DRM v3d Infinite Loop DoS Vulnerability
- CVE-2026-46521MEDIUMImageMagick LZMA Out-of-Bounds Write – Patch & Detection Guide