CVE-2026-57204: pypdf Denial-of-Service Memory Exhaustion Vulnerability
pypdf, a widely-used open-source Python library for working with PDF files, contains a denial-of-service vulnerability that allows an attacker to craft a malicious PDF capable of consuming excessive memory on systems that parse it. The flaw stems from the library's failure to properly enforce memory limits when processing PDF content streams that lack explicit length declarations. An attacker would need to trick a user into opening or processing such a PDF, but once they do, the parsing operation can exhaust available memory and crash or severely degrade the affected application.
Source data · NVD / CISA · public domain
- CVSS
- 3.1 · 6.5 MEDIUM · CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H
- Weaknesses (CWE)
- CWE-400
- Affected products
- 1 configuration(s)
- Published / Modified
- 2026-06-30 / 2026-07-06
NVD description (verbatim)
pypdf is a free and open-source pure-python PDF library. Prior to 6.13.3, a maliciously crafted PDF can cause DoS. An attacker who uses this vulnerability can craft a PDF which leads to large memory usage, as MAX_DECLARED_STREAM_LENGTH is sometimes ignored. This requires parsing a content stream without a /Length value. This issue has been fixed in version 6.13.3.
2 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
CVE-2026-57204 is a resource exhaustion vulnerability in pypdf prior to version 6.13.3. The root cause is improper handling of the MAX_DECLARED_STREAM_LENGTH safeguard when a PDF content stream does not include a /Length field. Under normal circumstances, this limit prevents a single stream declaration from consuming unbounded memory during parsing. However, the implementation contains a code path that bypasses this protection when the /Length value is absent, allowing a crafted PDF to trigger memory allocation far beyond intended limits. This is classified as an Uncontrolled Resource Consumption vulnerability (CWE-400).
Business impact
For organizations and developers relying on pypdf to process user-supplied or untrusted PDFs, this vulnerability poses a service availability risk. Web applications, document processing pipelines, batch analysis tools, and any service that automatically parses PDF uploads could be forced offline or become unresponsive. The impact is heightened in multi-tenant or shared infrastructure scenarios where one malicious PDF could degrade performance for other users. While confidentiality and integrity are not at risk, availability degradation can result in lost productivity, service disruptions, and reputational damage.
Affected systems
Any deployment using pypdf versions prior to 6.13.3 is affected. This includes direct usage in Python applications, as well as downstream tools and services that bundle or depend on pypdf. Common use cases include document management systems, PDF-to-text converters, automated report generators, and integration platforms that accept user-uploaded PDFs. The vulnerability is network-accessible in scenarios where the PDF is fetched from an untrusted source or supplied by an end-user.
Exploitability
Exploitation requires user interaction—specifically, the processing of an attacker-crafted PDF by the vulnerable library. The attack vector is network-based, making it feasible for an attacker to distribute malicious PDFs via email, web forms, file-sharing services, or other channels. The low attack complexity and lack of privilege requirements lower the barrier to entry. However, the attacker cannot directly trigger parsing from a remote system; they must rely on a user or automated system to open or process the file. Once parsed, the memory exhaustion occurs deterministically, making exploitation reliable.
Remediation
Upgrade pypdf to version 6.13.3 or later, which includes a fix that properly enforces MAX_DECLARED_STREAM_LENGTH across all parsing code paths, including those handling streams without explicit /Length fields. Organizations should verify compatibility with their existing codebase and test the upgrade in a staging environment before rolling out to production. For systems where immediate patching is not feasible, consider implementing additional controls such as processing PDFs in isolated or resource-constrained containers, imposing timeout limits on parsing operations, and validating PDF integrity before processing.
Patch guidance
The fix is available in pypdf 6.13.3 and later releases. Update your Python environment using your package manager (e.g., `pip install --upgrade pypdf==6.13.3` or specify `pypdf>=6.13.3` in your requirements file). Verify the installed version with `pip show pypdf`. If you maintain downstream dependencies or applications that bundle pypdf, ensure they are updated and re-released to pull in the patched library version. Confirm the patch is applied by testing with known problematic PDF samples if available.
Detection guidance
Monitor for signs of resource exhaustion in systems that parse PDFs: watch for unexpected memory usage spikes, out-of-memory exceptions, or process crashes in pypdf-dependent services. Implement application-level logging to capture PDF parsing errors and resource warnings. At the network level, inspect inbound PDFs for suspicious characteristics (missing /Length fields combined with large declared stream sizes, unusual stream objects, etc.) if your security tools support PDF analysis. Consider implementing resource limits (memory, CPU time) at the container or process level to prevent a single malformed PDF from affecting system stability.
Why prioritize this
While the CVSS score of 6.5 (MEDIUM) reflects the requirement for user interaction and limited attack surface, the practical risk depends on your organization's exposure. Prioritize this if you: (1) process user-uploaded or externally-sourced PDFs at scale, (2) run pypdf in a shared or cloud environment where resource exhaustion affects other users, or (3) use automated or batch PDF processing without human oversight. Organizations that only process internally-generated or trusted PDFs can defer patching, but should still plan an update within your normal maintenance cycle.
Risk score, explained
The CVSS 3.1 score of 6.5 (MEDIUM) reflects a network-accessible, low-complexity attack with no privilege requirements (AV:N/AC:L/PR:N) but mandatory user interaction (UI:R). Impact is limited to availability (A:H), with no effect on confidentiality or integrity (C:N/I:N). The score appropriately balances the ease of crafting a malicious PDF against the need for human or automated action to parse it, and against the high likelihood of causing a denial of service once triggered.
Frequently asked questions
Does this vulnerability allow an attacker to read sensitive data from a PDF or inject malicious code?
No. CVE-2026-57204 is strictly a denial-of-service flaw that causes memory exhaustion. It does not enable data theft, privilege escalation, or code execution. The attacker can only crash or degrade the service parsing the PDF.
What if we process PDFs in isolated containers or with resource limits already in place?
Resource limits provide a valuable defense-in-depth layer, but they do not eliminate the vulnerability. A well-tuned limit may cause the parsing process to fail gracefully rather than crash the entire system, reducing user impact. However, you should still apply the patch to eliminate the root cause and avoid relying solely on operational controls.
Can we detect and reject malicious PDFs before parsing them?
Detecting anomalous PDFs at intake (e.g., missing /Length fields in streams) can provide additional protection, but requires PDF validation logic that may be complex to implement reliably. The primary mitigation is upgrading pypdf. If you implement pre-parsing inspection, treat it as a supplementary control, not a substitute for patching.
Does this affect older Python versions or other programming languages?
CVE-2026-57204 is specific to the pypdf Python library. Other PDF libraries in other languages are not directly affected, though they may have their own similar vulnerabilities. Verify the PDF parsing library versions in your entire stack independently.
This analysis is provided for informational purposes and reflects publicly available information as of the publication date. Specific organizational risk depends on your use of pypdf, the nature of PDFs you process, and your operational controls. Always verify patch availability and compatibility against official vendor advisories before deployment. SEC.co makes no warranty regarding the completeness or accuracy of this intelligence and recommends consulting with your security team or vendor for definitive guidance on your environment. Source: NVD (public-domain), retrieved 2026-08-09. Analysis generated by SEC.co (claude-haiku-4-5).
Related vulnerabilities
- CVE-2026-48155MEDIUMpypdf Denial of Service via Malicious PDF Memory Exhaustion
- CVE-2026-49461MEDIUMpypdf Memory Exhaustion Vulnerability – Patch to 6.12.2
- CVE-2026-59936HIGHpypdf Infinite Loop Denial of Service Vulnerability (6.14.1)
- CVE-2026-59937HIGHpypdf Denial-of-Service via Malformed PDF Cross-Reference Streams
- CVE-2019-25721MEDIUMDräger Infinity M300 Denial-of-Service Vulnerability – Network-Induced Device Reboots
- CVE-2019-25724MEDIUMDräger Infinity M300 Denial-of-Service Vulnerability Impact on Patient Monitoring
- CVE-2025-48648MEDIUMAndroid NotificationManagerService Resource Exhaustion DoS
- CVE-2026-0042MEDIUMAndroid UBSan Resource Exhaustion Denial of Service