Vulnerability · Published Apr 18, 2022 · Assigned by GitHub_M

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

Medium 6.2

In plain English

A medium-severity infinite loop in PyPDF2 from py-pdf. Proof-of-concept exploit code is public. The chance it is exploited in the next 30 days is estimated at 1.3% (higher than 71% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)6.2Medium
Exploit odds (30 days)1.3%top 28.9% of all CVEs
Exploited in the wildNo reportsCISA SSVC: poc
Attack toolingNoneno public tooling known

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.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
Debian:12pypdf21.27.9-1DEBIAN-CVE-2022-24859
PyPIpypdf21.27.5GHSA-xcjx-m2pj-8g79
PyPIpypdf21.27.5PYSEC-2022-194
Ubuntu:22.04:LTSpypdf21.26.0-4ubuntu0.22.04.1USN-6176-1
Ubuntu:22.04:LTSpypdf21.26.0-4ubuntu0.22.04.1UBUNTU-CVE-2022-24859

Affected products (as reported)

VendorProductVersions
py-pdf PyPDF2 < 1.27.5

Weakness: CWE-835 · Vector: CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

References