CVE-2022-24859
mediumpriority · track · 22EPSS 0.013 · 71 %ileEURUUSEPSS · scored 2026-10-28
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.
cvss
Technical severity, 0–10. One row per scoring source.
base score 0–10 · higher = more severe · hover a vector to decode
ssvc
A stakeholder decision — act, attend, or track — from exploitation and impact.
weaknesses
The CWE weakness classes this flaw belongs to.
affected products (13)
Products and version ranges known to be affected.
advisories (2)
Vendor and ecosystem advisories describing this.
- GHSA-xcjx-m2pj-8g79Manipulated inline images can cause Infinite Loop in PyPDF22022-04-22ghsa · osvUS
### Impact An attacker who uses this vulnerability can craft a PDF which leads to an infinite loop if the PyPDF2 user wrote the following code: ```python from PyPDF2 import PdfFileReader, PdfFileWriter from PyPDF2.pdf import ContentStream reader = PdfFileReader("malicious.pdf", strict=False) for page in reader.pages: ContentStream(page.getContents(), reader) ``` ### Patches [`PyPDF2==1.27.5`](https://pypi.org/project/PyPDF2) and later are patched. Credits to [Sebastian Krause](https://github.com/sekrause) for finding ([issue](https://github.com/py-pdf/PyPDF2/issues/329)) and fixing ([PR](https://github.com/py-pdf/PyPDF2/pull/740)) it.
- PYSEC-2022-1942022-04-18vendor · osvUS
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.
also known as (7)
Other names and identifiers for this entity.
sources
Which sources assert this record, and when.
references (23)
External citations — patches, advisories, analysis.
- https://cxsecurity.com/cveshow/CVE-2022-24859/cnnvd
- https://github.com/py-pdf/PyPDF2/issues/329cnnvd
- https://github.com/py-pdf/PyPDF2/pull/740cnnvd
- https://github.com/py-pdf/PyPDF2/releases/tag/1.27.5cnnvd
- https://github.com/py-pdf/PyPDF2/security/advisories/GHSA-xcjx-m2pj-8g79cnnvd
- https://lists.debian.org/debian-lts-announce/2022/06/msg00001.htmlcnnvd
- https://lists.debian.org/debian-lts-announce/2023/06/msg00013.htmlcnnvd
- https://vigilance.fr/vulnerability/PyPDF2-overload-via-ContentStream-readInlineImage-38502cnnvd
Attackers weaponise vulnerabilities like this against internet-exposed services. See what is exposed on your perimeter with a free passive scan.
Free scan