MEDIUM 5.3

CVE-2026-59938: pypdf Memory Exhaustion DoS Vulnerability

A memory exhaustion vulnerability exists in pypdf, a popular open-source Python PDF library. An attacker can craft a malicious PDF file that declares image dimensions far larger than the actual image data contained within it. When pypdf processes such a file, it allocates excessive memory based on the declared sizes, leading to memory exhaustion and denial of service. The flaw affects all versions prior to 6.14.0 and is resolved in that release.

Source data · NVD / CISA · public domain

CVSS
3.1 · 5.3 MEDIUM · CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
Weaknesses (CWE)
CWE-789
Affected products
1 configuration(s)
Published / Modified
2026-07-08 / 2026-07-09

NVD description (verbatim)

pypdf is a free and open-source pure-python PDF library. Prior to 6.14.0, an attacker can craft a PDF with declared image size values that are much too large compared to the actual data, causing large memory usage in pypdf image parsing. This issue is fixed in version 6.14.0.

4 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

CVE-2026-59938 is a denial-of-service vulnerability arising from improper memory allocation during PDF image parsing in pypdf. The vulnerability stems from a failure to validate the relationship between declared image dimensions in PDF metadata and actual image payload size. When pypdf's image parsing logic encounters a PDF with inflated dimension declarations, it pre-allocates memory buffers matching those declarations without sanity checks. An attacker exploits this by embedding crafted image objects with large declared height/width values but minimal actual data, causing the library to consume disproportionate system memory. This maps to CWE-789 (Memory Allocation with Excessive Size Value). The attack vector is network-based and requires no authentication or user interaction.

Business impact

Organizations relying on pypdf for server-side PDF processing face operational risk. Automated PDF parsing pipelines—common in document management, e-discovery, email scanning, and batch processing workflows—can be starved of memory by a single malicious file, causing service degradation or crashes. This is particularly concerning in SaaS platforms offering PDF conversion or analysis where untrusted user-supplied documents are processed. Unlike a code execution flaw, the impact is service availability rather than data breach, but repeated attacks can compromise platform stability.

Affected systems

The vulnerability affects pypdf versions prior to 6.14.0. pypdf is used across Python-based applications in finance, healthcare, legal, and technology sectors wherever PDF manipulation is needed. Any system consuming untrusted PDF input through pypdf and running an affected version is at risk. Systems running pypdf 6.14.0 or later are not vulnerable to this specific flaw.

Exploitability

This vulnerability is moderately easy to exploit from a practical standpoint. An attacker requires only the ability to supply a crafted PDF to a vulnerable application—no complex exploitation techniques, no privilege escalation, and no user action is needed to trigger the memory consumption. The attack surface is broad for any online service accepting PDF uploads or processing PDFs from external sources. However, the impact is limited to denial of service rather than confidentiality or integrity compromise. The CVSS 3.1 score of 5.3 (MEDIUM) reflects network accessibility and immediate availability impact but acknowledges the absence of data theft or system compromise.

Remediation

Update pypdf to version 6.14.0 or later. This is a straightforward fix requiring dependency version bump and testing to ensure application compatibility. For organizations unable to immediately patch, consider implementing resource limits (e.g., memory caps, timeouts) on PDF processing tasks as a temporary mitigation, though this does not eliminate the underlying vulnerability.

Patch guidance

Verify that pypdf has been updated to 6.14.0 or later in your Python environment. Use `pip show pypdf` to confirm the installed version. Test the patched version in a staging environment before production deployment to ensure no regressions with your PDF processing workflows. If pypdf is a transitive dependency, audit your dependency tree (e.g., `pip freeze`) to identify parent packages that may need updating to pull in the patched version.

Detection guidance

Monitor PDF processing applications for unusual memory consumption spikes correlated with specific PDF submissions. Implement application-level logging of image metadata (declared dimensions) during PDF parsing to flag anomalous size declarations. Network-based detection is difficult without deep packet inspection of PDF streams, but endpoint memory monitoring can alert on runaway processes. Collect PDF files from failed or slow-running jobs for forensic analysis if suspicion arises.

Why prioritize this

While this is a MEDIUM-severity flaw with a limited CVSS score, it should be prioritized in any organization processing untrusted PDFs at scale. The ease of exploit and wide applicability of pypdf in backend systems, combined with the operational impact of service unavailability, warrant timely patching. Organizations in regulated industries (finance, healthcare) where document processing is critical should prioritize this higher due to availability requirements.

Risk score, explained

The CVSS 3.1 score of 5.3 reflects a network-accessible vulnerability with low complexity and no special requirements, but limited scope (availability only) and no confidentiality or integrity impact. The score appropriately captures that this is a denial-of-service flaw rather than a critical code execution or data breach issue. However, contextual factors—such as how many systems rely on pypdf for production workflows—may warrant elevated prioritization within specific organizations despite the moderate base score.

Frequently asked questions

What versions of pypdf are affected?

All versions prior to 6.14.0 are vulnerable. Version 6.14.0 and all later releases contain the fix. Check your installed version with `pip show pypdf`.

Can this vulnerability be exploited remotely without user interaction?

Yes. Any application that processes untrusted PDF files through pypdf is automatically vulnerable if an attacker can supply a crafted PDF. No social engineering or user action is required to trigger the memory exhaustion.

Does patching pypdf require code changes to my application?

No. Updating the pypdf package to version 6.14.0 or later is sufficient; no application code modification is necessary unless your codebase was working around this issue.

Are there workarounds if I cannot patch immediately?

Temporary mitigations include enforcing strict memory limits and execution timeouts on PDF processing tasks, and rejecting PDFs with unusually large declared image dimensions. However, these are not complete fixes and patching is strongly recommended.

This analysis is provided for informational purposes and represents the state of the vulnerability as of the publication date. Security information and vulnerability data evolve; always verify patch availability and applicability against official vendor advisories and your specific environment. SEC.co makes no warranty regarding the completeness, accuracy, or timeliness of this information. Organizations should conduct their own risk assessment and testing before deploying patches. No exploit code or proof-of-concept is provided or endorsed. Source: NVD (public-domain), retrieved 2026-08-17. Analysis generated by SEC.co (claude-haiku-4-5).