NewApp Monitoring is liveSign up free
AgentbeamBeta
Open-source package vulnerability · PyPI

CVE-2026-42310: Pillow has a PDF Parsing Trailer Infinite Loop (DoS)

mediumCVSS 4.0 5.1 · 3.1 5.5GHSA-r73j-pqj5-w3x7

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.

Published May 4, 2026 · Updated May 13, 2026

Affected packages

pillow

Ecosystem
PyPI
Affected
>= 4.2.0, < 12.2.0
Fixed in
12.2.0
Check
pip show pillow

Advisory details

From the GitHub Advisory Database (CC BY 4.0).

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

Credited to kexinoh, radarhere.

References

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. No analysis has been written for this entry yet. Methodology

More PyPI vulnerabilities

All PyPI entries