CVE-2026-119208: pypdf has possible long runtimes/large memory usage for encrypted PDF files
pypdf before 6.21.3 can spend a long time and a lot of memory when you read the page count of an encrypted PDF whose `/Count` value is wrong. Upgrade to pypdf 6.21.3, which validates the page count after decryption.
Published Oct 30, 2026 · Analysis Oct 31, 2026
What an attacker can do
An encrypted PDF declares its page count in a /Count entry in the page tree. The advisory describes a crafted file that declares a wrong value, and the trigger is accessing the page count of that encrypted file. The 6.21.3 release notes include "Validates the page count after decrypting a document" (pull request 4270). That matches the advisory, though the sources do not describe the internal loop (CWE-400, CWE-770).
The attacker needs to get such a file to code that opens it and asks for its length, for example len(reader.pages). That call is common in upload checks, page limits and previews, which makes it an easy path to reach. The CVSS 4.0 vector shows no privileges needed, passive user interaction and high availability impact only.
The result is a worker that runs long or grows large. Several concurrent uploads can take down a small service. No data leaks and no code runs.
Who is affected
All pypdf releases below 6.21.3, for encrypted PDFs whose page count is read. Check the installed version with:
pip show pypdfSearch your code for len(reader.pages) and for page-count checks that run before any size or time limit.
pypdf
- Ecosystem
- PyPI
- Affected
- < 6.21.3
- Fixed in
- 6.21.3
- Check
pip show pypdf
How to fix it
Upgrade to pypdf 6.21.3:
pip install --upgrade "pypdf>=6.21.3"The maintainers' workaround is to apply the changes from pull request 4270. Until then, run page-count checks in a subprocess with a timeout and a memory limit.
How to tell if you were hit
Look for page-count or preview requests that run far longer than normal and for workers with large resident memory after handling an encrypted upload. Keep the files for analysis. No log line is named in the advisory, and no source reports exploitation.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Impact
An attacker who uses this vulnerability can craft a PDF which leads to large runtimes/memory usage. This requires accessing the page count of an encrypted PDF file, which itself declares a wrong /Count value.
Patches
This has been fixed in pypdf==6.21.3.
Workarounds
If you cannot upgrade yet, consider applying the changes from PR #4270.
Credited to DharmendraSoni5110.
Questions
- Do I need the password for CVE-2026-119208 to apply?
The advisory does not say. It names accessing the page count of an encrypted PDF with a wrong
/Count, and the fix validates the count after decryption.- Is this a memory or a runtime problem?
Both. The advisory says large runtimes and memory usage.
- Which version is patched?
pypdf 6.21.3, released on 27 October 2026.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
More PyPI vulnerabilities
All PyPI entriesCVE-2026-119203
pypdf has possible infinite loop when hitting EOF in standard xref table during trailer search
high7.1Oct 30, 2026CVE-2026-119204
pypdf has possible large memory usage when parsing page tree
high7.1Oct 30, 2026CVE-2026-119205
pypdf has possible infinite loop when cloning dictionaries
high7.1Oct 30, 2026CVE-2026-119206
pypdf has possible long runtimes when retrieving page labels
high7.1Oct 30, 2026CVE-2026-119207
pypdf has possible large memory usage for exceptions in strict mode
high7.1Oct 30, 2026CVE-2026-119209
pypdf has possible large memory usage when parsing cross-reference streams
high7.1Oct 30, 2026
