CVE-2026-96640 — python-pillow Pillow
Summary
Pillow is a Python imaging library. From 5.1.0 until 13.0.0, PdfParser.linearize_page_tree() in src/PIL/PdfParser.py treats a PDF /Pages graph as a tree without tracking duplicate indirect references. When Image.save(..., format="PDF", append=True) processes an attacker-controlled existing PDF whose /Kids arrays repeatedly reference the same child /Pages node, Pillow expands the shared subtree as distinct pages. A compact malformed PDF can therefore create exponentially many page references and consume disproportionate CPU before the append completes. This issue is fixed in version 13.0.0.
Severity breakdown
High · 8.2
An attacker without an account can exploit this over the network, without any user action, but only under specific conditions.
- Attack from
- the network (remotely)
- Attack complexity
- low (no special conditions)
- Special conditions
- only in some setups or conditions
- Login needed
- no
- User action needed
- no
- Impact
- high on availability, none on confidentiality and integrity
- Impact on other systems
- none
Weakness
Affected and fixed versions
| Product | Affected versions | Fixed in |
|---|---|---|
| python-pillow Pillow | >= 5.1.0, < 13.0.0 | — |
References by type
Vendor advisories
Patches and fixed releases
Affected
- python-pillow Pillow
What to do
- Check whether you run an affected product or version and apply the vendor's update or mitigation.
- Follow the vendor advisory and the references below for fixed versions and workarounds.
Frequently asked questions
What is CVE-2026-96640?
Pillow is a Python imaging library. From 5.1.0 until 13.0.0, PdfParser.linearizepagetree() in src/PIL/PdfParser.py treats a PDF /Pages graph as a tree without tracking duplicate indirect references. When Image.save(..., format="PDF", append=True) processes an attacker-controlled existing PDF whose /Kids arrays repeatedly reference the same child /Pages node, Pillow expands the shared subtree as distinct pages. Weakness type: Uncontrolled Resource Consumption (CWE-400).
How severe is CVE-2026-96640?
CVE-2026-96640 has a CVSS 4.0 base score of 8.2 (high), from the CNA (github.com). An attacker without an account can exploit this over the network, without any user action, but only under specific conditions.
Is CVE-2026-96640 being exploited?
Not as far as is known: CVE-2026-96640 is not in CISA's Known Exploited Vulnerabilities catalog as of November 26, 2026. EPSS estimates a 0.6% chance that it is exploited in the next 30 days.
Which versions are affected by CVE-2026-96640?
python-pillow Pillow >= 5.1.0, < 13.0.0.
How do I fix CVE-2026-96640?
Apply the update or mitigation in the vendor's advisory, linked on this page under Vendor advisories.