---
id: "CVE-2026-113786"
kind: "vulnerability"
aliases: ["CVE-2026-113786", "GHSA-5hx5-vpf9-5wcv"]
title: "pypdf: Unvalidated JPEG image data loading"
severity: "low"
cvss: 2.3
epss: 0.0037499999161809683
exploited: false
status: "open"
category: "package"
products: [{"name": "pypdf", "fixed": ["6.21.1"], "affected": "< 6.21.1", "ecosystem": "pypi"}]
ecosystems: ["pypi"]
tags: ["cwe-183", "cwe-20", "package", "pdf-processing", "pypdf", "python"]
not_affected_if: ["no-untrusted-pdfs", "pillow-not-installed"]
published_at: "2026-10-21T15:17:16+00:00"
first_seen_at: "2026-10-23T19:11:32+00:00"
updated_at: "2026-10-23T21:57:28+00:00"
sources: [{"source": "ghsa", "url": "https://github.com/advisories/GHSA-5hx5-vpf9-5wcv", "first_seen_at": "2026-10-23T19:11:32+00:00"}, {"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-113786", "first_seen_at": "2026-10-23T21:57:28+00:00"}]
---

# pypdf: Unvalidated JPEG image data loading

pypdf does not validate JPEG (/DCTDecode) image data before handing it to image parsers, so a crafted PDF can cause arbitrary image parsers to be invoked. The advisory describes this as only reachable when the optional Pillow dependency is installed.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- pypi:pypdf affected < 6.21.1 fixed 6.21.1

## How to check

pip show pypdf and pip show pillow; affected if pypdf is below 6.21.1 and Pillow is installed.

## Fix

Upgrade pypdf to 6.21.1 or later. If you cannot upgrade, apply the changes from PR #4222 (https://github.com/py-pdf/pypdf/pull/4222).

## Timeline

- 2026-10-23T19:11:32+00:00 ghsa https://github.com/advisories/GHSA-5hx5-vpf9-5wcv
- 2026-10-23T21:57:28+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-113786

## From the sources

### 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](https://github.com/py-pdf/pypdf/releases/tag/6.21.1).

### Workarounds

If you cannot upgrade yet, consider applying the changes from PR [#4222](https://github.com/py-pdf/pypdf/pull/4222).

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
