CVE-2026-42310: Pillow: PDF Parsing Trailer Infinite Loop (DoS)
Impact An attacker can supply a malicious PDF that causes the process to hang indefinitely, consuming 100% CPU and making the application unresponsive.
Patches Patched version: 12.2.0.
PdfParser (introduced in Pillow 4.2.0) follows Prev pointers in PDF trailers to read cross-reference sections. If a trailer's Prev pointer references an offset that has already been processed — either pointing to itself or forming a longer cycle — the parser enters an infinite loop. Pillow now tracks previously processed trailer offsets and raises an error if a cycle is detected.
Workarounds Use any version but the affected versions: >= 4.2.0, < 12.2.0
Resources - Fix: https://github.com/python-pillow/Pillow/pull/9519
Other sources
Pillow is a Python imaging library. From version 4.2.0 to before version 12.2.0, an attacker can supply a malicious PDF that causes the process to hang indefinitely, consuming 100% CPU and making the application unresponsive. This issue has been patched in version 12.2.0.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/pillowto a version that resolves this vulnerability.Fixed in 12.2.0 - Upgrade
Upgrade
debian/pillowto a version that resolves this vulnerability.Fixed in 12.2.0-1 - Upgrade
Upgrade
Pillow (PdfParser)to a version that resolves this vulnerability.Fixed in 12.2.0Patch Pillow: PDF Parsing Trailer Infinite Loop (DoS) - Compensating control
Avoid using affected Pillow versions (>= 4.2.0 and < 12.2.0) by upgrading to 12.2.0, since those versions allow a malicious PDF to cause an indefinite hang with 100% CPU.
Event History
Frequently Asked Questions
What is the severity of CVE-2026-42310?
CVE-2026-42310 is considered a high severity vulnerability due to its potential to render applications unresponsive.
How do I fix CVE-2026-42310?
To fix CVE-2026-42310, you should upgrade to version 12.2.0 or later of the Pillow library.
What type of attack is associated with CVE-2026-42310?
CVE-2026-42310 is associated with a denial-of-service attack caused by a malicious PDF file.
Which software versions are affected by CVE-2026-42310?
CVE-2026-42310 affects versions of Pillow from 4.2.0 up to, but not including, 12.2.0.
What happens when an application is exploited using CVE-2026-42310?
When exploited, an application hangs indefinitely, consuming 100% CPU and becoming unresponsive.