CVEfocus › CVE database › CVE-2022-24859

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

CVSS 6.2 MediumEPSS 1.3% (higher than 71% of CVEs)Published 2022-04-18Updated 2025-04-22Assigner: GitHub_M

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.

CWE-835

What to do

Fixed builds are available from Debian, PyPI, Ubuntu: see the table below for the fixed version per release.

Ubuntu has not shipped a fix for every release yet.

Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.

curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \
  -H "Content-Type: text/plain" --data-binary @inventory.txt

Vendor status at a glance

4Fixed
2Fix pending

Status by vendor and release

From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.

ReleasePackageStatusFixed versionAdvisory
Ubuntu 22.04pypdf2Fixed1.26.0-4ubuntu0.22.04.1UBUNTU-CVE-2022-24859
Ubuntu 20.04pypdf2Fixed1.26.0-3ubuntu1.20.04.1UBUNTU-CVE-2022-24859
Ubuntu 18.04pypdf2Fix pending1.26.0-2ubuntu0.1~esm1 (Ubuntu Pro)UBUNTU-CVE-2022-24859
Ubuntu 16.04pypdf2Fix pending1.25.1-1ubuntu0.1~esm1 (Ubuntu Pro)UBUNTU-CVE-2022-24859
Debian 12pypdf2Fixed1.27.9-1DEBIAN-CVE-2022-24859
PyPI librarypypdf2Fixed1.27.5PYSEC-2022-194

What the vendor says

As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.

References

About this page

Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.