CVE-2026-96640 Pillow PDF append accepts malformed shared page-tree DAG causing resource exhaustion

High 8.2 Published Updated
Exploited in the wild
Not known
Fix
Available

What is CVE-2026-96640?

CVE-2026-96640 is a high-severity vulnerability in Python Pillow, published on 21 Oct 2026.

Official description

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.

Weakness: CWE-407, CWE-400

Which versions are affected by CVE-2026-96640?

3 open source packages ship an affected version, including pillow and Pillow. It affects 1 product.

PackageAffectedFixed in
pillow BitnamiFrom 5.1.013.0.0
pillow PyPIFrom 5.1.013.0.0
Pillow PyPIFrom 5.1.013.0.0

Products include Python Pillow.

How do I fix CVE-2026-96640?

Upgrade pillow to 13.0.0 or later.

Is CVE-2026-96640 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-96640 exists.

All Python Pillow vulnerabilities

Sources

Also known as BIT-pillow-2026-96640, DEBIAN-CVE-2026-96640, ECHO-5c73-e106-c793, GHSA-mrfp-p49p-3hf2, ROOT-APP-PYPI-CVE-2026-96640, UBUNTU-CVE-2026-96640.

Is CVE-2026-96640 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free