Skip to content
Fencer Vulns
medium 6.2

CVE-2022-24859 json

Manipulated inline images can cause Infinite Loop in PyPDF2

published 2022-04-18 4 y ago modified 2026-06-17 4 mo ago also GHSA-xcjx-m2pj-8g79 , PYSEC-2022-194 , EUVD-2022-0214

cvss
6.2
version 3.1, CNA
cisa kev
Not listed
not in CISA's catalog
epss
1.3%
EPSS 1.3% chance of exploitation in 30 days, percentile 71%
public exploits
0
none known

Summary

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.

Patch / fix

  • pypi pypdf2 1.27.5
  • pypdf2_project pypdf2 1.27.5
  • pypdf2 Debian 12 1.27.9-1

debian advisories DEBIAN-CVE-2022-24859

  • pypdf2 Ubuntu 20.04 LTS 1.26.0-3ubuntu1.20.04.1
  • pypdf2 Ubuntu 22.04 LTS 1.26.0-4ubuntu0.22.04.1
  • pypdf2 Ubuntu Pro 16.04 LTS 1.25.1-1ubuntu0.1~esm1
  • pypdf2 Ubuntu Pro 18.04 LTS 1.26.0-2ubuntu0.1~esm1

ubuntu advisories UBUNTU-CVE-2022-24859

Ubuntu security data © Canonical Ltd., from https://github.com/canonical/ubuntu-security-notices via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0

  • python-PyPDF2 Package Hub 15 SP6, openSUSE Leap 15.6 1.26.0-bp156.4.3.1

opensuse advisories openSUSE-SU-2024:0366-1

Vendor advisories

What the vendors themselves say about their products: affected, fixed or not affected, and what to do.

red hat product security vex CVE-2022-24859 updated cvss 5.5

PyPDF2: infinite loop vulnerability

  • Red Hat Quay 3 quay/quay-rhel8
    affected: no fix available

Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf

CISA SSVC

Exploitation
Proof of concept is public
Automatable
no
Technical impact
partial
Assessed
18 mo ago

Exploit prediction

1.33% chance of exploitation in the next 30 days, higher than 71% of all scored CVEs (FIRST EPSS, 2026-11-08).

Exploits and checks

  • github.com https://github.com/py-pdf/PyPDF2/security/advisories/GHSA-xcjx-m2pj-8g79 referenced PoC, tagged "exploit" by a source, unverified
  • github.com https://github.com/py-pdf/PyPDF2/issues/329 referenced PoC, tagged "exploit" by a source, unverified

CVSS scores

assigned by version score vector
CNA 3.1 6.2 CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
NVD 3.1 5.5 CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H
NVD 2.0 4.3 AV:N/AC:M/Au:N/C:N/I:N/A:P
GitHub 3.1 6.2 CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Affected packages

ecosystem package affected fixed in
pypi pypdf2
<1.27.5
1.27.5

Affected products

  • py-pdf PyPDF2

Classification

Weakness
  • CWE-835 Loop with Unreachable Exit Condition

References

Sources

Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.