CVE-2022-24859 Manipulated inline images can cause Infinite Loop in PyPDF2

Medium 6.2 Published Updated

An attacker can cause a denial of service via an infinite loop in PyPDF2 by crafting a malicious PDF with manipulated inline images.

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-2022-24859?

CVE-2022-24859 is a medium-severity denial of service vulnerability in Debian Debian Linux, published on 18 Apr 2022. It can only be exploited from the same machine or local network, with no action from the victim.

Official description

PyPDF2 is an open source python PDF library capable of splitting, merging, cropping, and transforming the pages of PDF files. In versions prior to 1.27.5 an attacker who uses this vulnerability can craft a PDF which leads to an infinite loop if the PyPDF2 if the code attempts to get the content stream. The reason is that the last while-loop in `ContentStream._readInlineImage` only terminates when it finds the `EI` token, but never actually checks if the stream has already ended. This issue has been resolved in version `1.27.5`. Users unable to upgrade should validate and PDFs prior to iterating over their content stream.

Weakness: CWE-835

Which versions are affected by CVE-2022-24859?

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

PackageAffectedFixed in
pypdf2 PyPIAll versions1.27.5
pypdf2 PyPIAll versions1.27.5
PyPDF2 PyPIAll versions1.27.5
Linux distribution packages (2)
python-PyPDF2 SUSE:Package Hub 15 SP6All versions1.26.0-bp156.4.3.1
python-PyPDF2 openSUSE:Leap 15.6All versions1.26.0-bp156.4.3.1

Products include Debian Debian Linux, Pypdf2 Project Pypdf2.

How do I fix CVE-2022-24859?

Upgrade pypdf2 to 1.27.5 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-2022-24859 being exploited?

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

All Debian Debian Linux vulnerabilities

Sources

Also known as DEBIAN-CVE-2022-24859, DLA-3039-1, DLA-3451-1, GHSA-xcjx-m2pj-8g79, MGASA-2022-0224, PYSEC-2022-194 and 3 more.

Is CVE-2022-24859 in your software?

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

Check your SBOMs for free