CVE-2026-119209: pypdf has possible large memory usage when parsing cross-reference streams
pypdf before 6.21.3 can be made to allocate a very large amount of memory by a crafted PDF that uses cross-reference streams. Any service or script that opens untrusted PDFs with pypdf can be knocked over by running out of memory. Upgrade to pypdf 6.21.3.
Published Oct 30, 2026 · Analysis Oct 31, 2026
What an attacker can do
A PDF stores its object index in cross-reference (xref) streams. These streams are compressed. A highly compressible stream can declare millions of entries while staying inside the existing stream size limits, so a small file expands into a large in-memory table. Chaining several xref streams through the /Prev entry multiplies the effect. The fix also rejects negative /Index counts, which slipped past the existing per-stream clamp.
The attacker needs no account and no privileges. They only need the victim to open the file, which matches the user-interaction flag in the CVSS 4.0 vector. The result is a denial of service: the process uses all available memory and is killed or the host slows down. There is no confidentiality or integrity impact. The risk is highest for upload endpoints, document-ingestion pipelines and RAG indexers that parse PDFs from outside sources with pypdf, because one bad upload can take down a worker.
Who is affected
All pypdf versions below 6.21.3 are affected. The flaw triggers only when pypdf opens a file with cross-reference streams, which is common in modern PDFs.
Check your installed version:
pip show pypdfAlso check lock files and container images, since pypdf is often a transitive dependency of document-processing libraries.
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 fix adds a document-wide budget for xref stream entries, so the total across the whole document is capped, not just each stream. If you cannot upgrade yet, the advisory says to apply the changes from pull request 4269 to your copy of pypdf. As an extra safeguard, run PDF parsing in a worker with a memory limit.
How to tell if you were hit
Look for worker or container out-of-memory kills (OOMKilled, Killed in dmesg) that coincide with PDF uploads or parsing jobs. Find the input file that was being processed and check for a small file with several xref streams linked by /Prev. The sources describe no log line specific to this flaw.
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 opening a file with cross-reference streams.
Patches
This has been fixed in pypdf==6.21.3.
Workarounds
If you cannot upgrade yet, consider applying the changes from PR #4269.
Credited to PabloAlaniz.
Questions
- Does CVE-2026-119209 allow code execution?
No. The advisory describes only large memory usage when parsing cross-reference streams. The CVSS 4.0 vector rates the impact as availability only, with no confidentiality or integrity effect.
- Which pypdf version fixes it?
pypdf 6.21.3. All versions below 6.21.3 are listed as vulnerable. The fix caps the total number of xref stream entries across a document.
- Is there a workaround if I cannot upgrade?
The advisory suggests applying the changes from pull request 4269 to your installed copy. Limiting the memory of the process that parses PDFs also contains the damage.
References
Read for this analysis:
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-119208
pypdf has possible long runtimes/large memory usage for encrypted PDF files
high7.1Oct 30, 2026
