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

Published Oct 21, 2026
·
Updated

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. 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.

Affected Software

1 affected component
pypi/Pillow>=5.1.0<13.0.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade Pillow to a version that resolves this vulnerability.

    Fixed in 13.0.0

Event History

Oct 21, 2026
CVE Published
via MITRE·09:03 PM
Data Sourced
via MITRE·09:03 PM
DescriptionWeakness

Frequently Asked Questions

1

Who is exposed to this issue?

Applications using Pillow versions 5.1.0 through 12.x are exposed when they append to an attacker-controlled existing PDF with Image.save(..., format="PDF", append=True). Processing ordinary PDFs or creating a PDF without appending to an existing file is not described as affected.

2

What must an attacker provide to trigger the resource exhaustion?

The attacker needs to supply an existing malformed PDF whose /Pages /Kids arrays repeatedly reference the same child /Pages node. This shared page-tree DAG causes Pillow to expand the same subtree repeatedly while processing the append operation.

3

What is the impact during exploitation?

A compact malicious PDF can cause exponentially many page references to be expanded, resulting in disproportionate CPU consumption before the append operation completes.

4

What remediation is available?

Upgrade Pillow to version 13.0.0, which fixes the issue.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203