CVE-2022-24859Manipulated inline images can cause Infinite Loop in PyPDF2
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.
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
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.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 22.04 | pypdf2 | Fixed | 1.26.0-4ubuntu0.22.04.1 | UBUNTU-CVE-2022-24859 |
| Ubuntu 20.04 | pypdf2 | Fixed | 1.26.0-3ubuntu1.20.04.1 | UBUNTU-CVE-2022-24859 |
| Ubuntu 18.04 | pypdf2 | Fix pending | 1.26.0-2ubuntu0.1~esm1 (Ubuntu Pro) | UBUNTU-CVE-2022-24859 |
| Ubuntu 16.04 | pypdf2 | Fix pending | 1.25.1-1ubuntu0.1~esm1 (Ubuntu Pro) | UBUNTU-CVE-2022-24859 |
| Debian 12 | pypdf2 | Fixed | 1.27.9-1 | DEBIAN-CVE-2022-24859 |
| PyPI library | pypdf2 | Fixed | 1.27.5 | PYSEC-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.
- py-pdf PyPDF2: affected: < 1.27.5
References
- https://github.com/py-pdf/PyPDF2/security/advisories/GHSA-xcjx-m2pj-8g79
- https://github.com/py-pdf/PyPDF2/issues/329
- https://github.com/py-pdf/PyPDF2/pull/740
- https://github.com/py-pdf/PyPDF2/releases/tag/1.27.5
- https://lists.debian.org/debian-lts-announce/2022/06/msg00001.html
- https://lists.debian.org/debian-lts-announce/2023/06/msg00013.html
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.