Manipulated inline images can cause Infinite Loop in PyPDF2
Key facts
- Attack vector
- Local
- Privileges required
- None
- User interaction
- None
- Attack complexity
- Low
- Impact type
- Denial of service
- Confidentiality · integrity · availability
- None · None · High
- Fix status
- Partial Red Hat: 1 without a fix
Attack profile from CVSS 3.1 · CNA. Fix status from CNA, GitHub and Red Hat. Impact type from CWE-835.
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.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- Poc
- Automatable
- No
- Technical impact
- Partial
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| py-pdf | PyPDF2 | before 1.27.5 | 1.27.5 | Patch available | CNA |
| — | PyPDF2 (PyPI) | before 1.27.5 | 1.27.5 | Patch available | GHSA-xcjx-m2pj-8g79 |
- PyPDF2 Vendorpy-pdf Affected before 1.27.5 Fixed in 1.27.5 Patch available CNA
- PyPDF2 (PyPI) Vendor— Affected before 1.27.5 Fixed in 1.27.5 Patch available GHSA-xcjx-m2pj-8g79
CPE configurations NVD · 2
| CPE | Versions | Role | Vendor |
|---|---|---|---|
| cpe:2.3:a:pypdf2_project:pypdf2:*:*:*:*:*:*:*:* | before 1.27.5 | Vulnerable | Pypdf2 Project |
| cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:* | 9.0 | Vulnerable | Debian |
- cpe:2.3:a:pypdf2_project:pypdf2:*:*:*:*:*:*:*:* Versions before 1.27.5 Vulnerable ·Pypdf2 Project
- cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:* Versions 9.0 Vulnerable ·Debian
Remediation
- Fix · CNA PyPDF2 (py-pdf) Fixed in 1.27.5
- Fix · GHSA-xcjx-m2pj-8g79 PyPDF2 (PyPI) Fixed in 1.27.5 Advisory →
Vendor assessments
Red Hat
Red Hat rating: Low. Red Hat's page for this CVE →
| Product | Status | Plan or fix |
|---|---|---|
| Red Hat Quay 3 | Affected | No fix yet |
Timeline
- 2026-10-02 Threatist record created from CVE-2022-24859
- 2026-10-03 Alias added: GHSA-xcjx-m2pj-8g79
References
Exploit 2
Advisory 3
More py-pdf vulnerabilities
- TI-2026-79334 Exponential SVG use expansion exhausts CPU and memory in fpdf2 CVSS 3.1MEDIUM 6.5
- TI-2023-18601 Infinite Loop when reading malformed objects in pypdf CVSS 3.1MEDIUM 6.5
- TI-2023-18305 Infinite Loop when a comment isn't followed by a character in pypdf CVSS 3.1MEDIUM 6.2
- TI-2026-42743 pypdf: Possible infinite loop for not terminated inline images CVSS 4.0HIGH 8.7
- TI-2026-42742 pypdf: Possible infinite loop for not terminated inline images (ASCII85 and ASCIIHex filter) CVSS 4.0HIGH 8.7
- TI-2026-65557 pypdf: Possible large memory usage when retrieving alphabetical page labels CVSS 4.0HIGH 8.7
Sources
- CVE-2022-24859 · CVE Program
- CVE-2022-24859 · NVD
- FIRST EPSS
- GHSA-xcjx-m2pj-8g79 · GitHub Advisory Database · CC BY 4.0
- CVE-2022-24859 · Red Hat security data · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences