CVE-2026-113786: pypdf: Unvalidated JPEG image data loading
Impact
An attacker who uses this vulnerability can craft a PDF which leads to arbitrary image parsers being called. This requires loading an image which claims to use the /DCTDecode filter (JPEG data).
Users which do not have the optional Pillow dependency installed in their environment are not affected.
Patches
This has been fixed in pypdf==6.21.1.
Workarounds
If you cannot upgrade yet, consider applying the changes from PR #4222.
Other sources
pypdf is a free and open-source pure-python PDF library. Prior to 6.21.1, an attacker can craft a PDF containing image data labeled with the /DCTDecode filter that causes Pillow to select and invoke an unintended image parser when the image is loaded. Environments without the optional Pillow dependency are not affected. This issue is fixed in version 6.21.1.
— Ubuntu
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/pypdfto a version that resolves this vulnerability.Fixed in 6.21.1 - Upgrade
Upgrade
debian/pypdfto a version that resolves this vulnerability.Fixed in 6.21.1-1 - Upgrade
Upgrade
pypdfto a version that resolves this vulnerability.Fixed in 6.21.1
Event History
Frequently Asked Questions
Which deployments are affected?
Only pypdf environments that have the optional Pillow dependency installed are affected. Environments without Pillow are not affected.
What does an attacker need to exploit this issue?
An attacker needs to provide a crafted PDF containing image data labeled with the /DCTDecode filter and have that image loaded by the affected environment.
What remediation is available?
Upgrade pypdf to version 6.21.1, which fixes the issue.