CVE-2023-36807 Infinite Loop when reading malformed objects in pypdf

Medium 6.2 Published Updated

An attacker can cause a denial of service via infinite loop by crafting a malformed PDF processed by the pypdf library.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Local or same network only
Victim action needed
Not needed
Fix
Available

What is CVE-2023-36807?

CVE-2023-36807 is a medium-severity denial of service vulnerability in Pypdf Project Pypdf, published on 30 Jun 2023. It can only be exploited from the same machine or local network, with no action from the victim.

Official description

pypdf is a pure-python PDF library capable of splitting, merging, cropping, and transforming the pages of PDF files. In version 2.10.5 an attacker who uses this vulnerability can craft a PDF which leads to an infinite loop. This infinite loop blocks the current process and can utilize a single core of the CPU by 100%. It does not affect memory usage. That is, for example, the case if the user extracted metadata from such a malformed PDF. Versions prior to 2.10.5 throw an error, but do not hang forever. This issue was fixed with https://github.com/py-pdf/pypdf/pull/1331 which has been included in release 2.10.6. Users are advised to upgrade. Users unable to upgrade should modify `PyPDF2/generic/_data_structures.py::read_object` to an an error throwing case. See GHSA-hm9v-vj3r-r55m for details.

Weakness: CWE-835

Which versions are affected by CVE-2023-36807?

3 open source packages ship an affected version, including pypdf2 and PyPDF2. It affects 1 product.

PackageAffectedFixed in
pypdf2 PyPIFrom 2.10.52.10.6
pypdf2 PyPIFrom 2.10.52.10.6
PyPDF2 PyPIFrom 2.10.52.10.6

Products include Pypdf Project Pypdf.

How do I fix CVE-2023-36807?

Upgrade pypdf2 to 2.10.6 or later.

Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.

Is CVE-2023-36807 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-36807 exists.

All Pypdf Project Pypdf vulnerabilities

Sources

Also known as DEBIAN-CVE-2023-36807, GHSA-hm9v-vj3r-r55m, PYSEC-2026-1836.

Is CVE-2023-36807 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free