CVE-2026-119204: pypdf has possible large memory usage when parsing page tree
pypdf before 6.21.4 can use a very large amount of memory when it parses the page tree of a crafted PDF whose pages share many resources. A small file can exhaust memory in the process that reads it. Anyone who handles untrusted PDFs with pypdf is affected. Upgrade to pypdf 6.21.4.
Published Oct 30, 2026 · Analysis Oct 31, 2026
What an attacker can do
The advisory ties the problem to parsing a page tree with many shared resources. The 6.21.4 release notes describe the fix as limiting the number of page attributes copied during flattening (pull request 4290). Page attributes such as resources are inherited down the page tree. Flattening copies them onto each page, so a file where many pages point at the same large resources can multiply memory use (CWE-400).
The attacker needs only to supply a PDF to code that walks the page tree, for example when you iterate over pages or count them. There is no code execution and no data exposure. The effect is availability: the process grows until it is slowed down or killed by the operating system's out-of-memory handler. On shared workers, one upload can take down other jobs on the same host.
Who is affected
All pypdf releases below 6.21.4 are affected, when they parse a page tree with many shared resources. Check the installed version with:
pip show pypdfCheck transitive installs too, since many document tools depend on pypdf.
pypdf
- Ecosystem
- PyPI
- Affected
- < 6.21.4
- Fixed in
- 6.21.4
- Check
pip show pypdf
How to fix it
Upgrade to pypdf 6.21.4:
pip install --upgrade "pypdf>=6.21.4"The maintainers say that, if you cannot upgrade, you can apply the changes from pull request 4290. Until then, cap memory for PDF-parsing workers with container or ulimit limits and reject oversized uploads.
How to tell if you were hit
Watch for pypdf-based workers whose resident memory climbs sharply while handling a single document, and for out-of-memory kills that line up with specific uploaded PDFs. Keep those files for review. The advisory lists no log line or network indicator.
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 memory usage. This requires parsing the page tree with many shared resources.
Patches
This has been fixed in pypdf==6.21.4.
Workarounds
If you cannot upgrade yet, consider applying the changes from PR #4290.
Credited to smaeljaish771.
Questions
- What triggers the memory growth in CVE-2026-119204?
Parsing a page tree with many shared resources in a crafted PDF. The fix limits how many page attributes are copied during flattening.
- Is pypdf 6.21.4 safe from CVE-2026-119204?
Yes, 6.21.4 is the patched version named in the advisory. All earlier versions are affected.
- Does the attacker need to be logged in?
Not to the library. The CVSS 4.0 vector shows no privileges required and passive user interaction. What matters is whether untrusted PDFs reach your pypdf code.
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-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-119208
pypdf has possible long runtimes/large memory usage for encrypted PDF files
high7.1Oct 30, 2026CVE-2026-119209
pypdf has possible large memory usage when parsing cross-reference streams
high7.1Oct 30, 2026
