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

- Severity: Medium 6.2 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 1.33%, higher than 71% of CVEs (2026-12-01)
- Public exploit code or proof of concept: 2 links below, marked "exploit"
- Published: 2022-04-18T00:00:00.000Z
- Modified: 2026-06-17T04:32:40.613Z
- Also known as: GHSA-xcjx-m2pj-8g79, PYSEC-2022-194
- Weaknesses: CWE-835
- SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial
- Assigned by: GitHub_M

## 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.

(As written by CVE List.)

## Affected

- py-pdf PyPDF2: < 1.27.5
- pypdf2 (PyPI): before 1.27.5
- pypdf2_project pypdf2: before 1.27.5
- debian debian_linux: 9.0

## Every score

- GitHub_M: CVSS:3.1 6.2 Medium `CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
- GitHub: CVSS:3.1 6.2 Medium `CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
- GitHub: CVSS:4.0 Medium `CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N`
- NVD: CVSS:3.1 5.5 Medium `CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H`
- NVD: CVSS:2.0 4.3 Medium `AV:N/AC:M/Au:N/C:N/I:N/A:P`

## References

- <https://github.com/py-pdf/PyPDF2/security/advisories/GHSA-xcjx-m2pj-8g79> (exploit, advisory, third-party-advisory, web)
- <https://github.com/py-pdf/PyPDF2/issues/329> (exploit, report, third-party-advisory, web)
- <https://github.com/py-pdf/PyPDF2/pull/740> (patch, third-party-advisory, web)
- <https://github.com/py-pdf/PyPDF2/releases/tag/1.27.5> (release-notes, third-party-advisory, web)
- <https://lists.debian.org/debian-lts-announce/2022/06/msg00001.html> (mailing-list, third-party-advisory, web)
- <https://lists.debian.org/debian-lts-announce/2023/06/msg00013.html> (mailing-list, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2022-24859> (advisory)
- <https://github.com/py-pdf/PyPDF2> (package)
- <https://github.com/pypa/advisory-database/tree/main/vulns/pypdf2/PYSEC-2022-194.yaml> (web)

## Sources

- CVE List: [CVE-2022-24859](https://www.cve.org/CVERecord?id=CVE-2022-24859), CVE Terms of Use, modified 2025-04-22
- GitHub Advisory Database: [GHSA-xcjx-m2pj-8g79](https://github.com/advisories/GHSA-xcjx-m2pj-8g79), CC-BY-4.0, modified 2024-10-14
- NVD: [CVE-2022-24859](https://nvd.nist.gov/vuln/detail/CVE-2022-24859), Public domain, modified 2026-06-17
- PyPA Advisory Database: [PYSEC-2022-194](https://osv.dev/vulnerability/PYSEC-2022-194), CC-BY-4.0, modified 2023-11-08

---

Page: https://cve.day/CVE-2022-24859 · Whole record: https://cve.day/CVE-2022-24859.json · Rebuilt by cve.day 2026-11-25T22:58:10.820Z
