CVE-2022-24859
Manipulated inline images can cause Infinite Loop in PyPDF2
Reported by github_m · Published April 18, 2022
PyPDF2 is fixed in 1.27.5 (PyPI)
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.
Fixed versions
Upgrade to a fixed version or later. Language registries are listed first, then Linux distributions, then vendor products.
| Package | Ecosystem | Fixed in |
|---|---|---|
| PyPDF2 | PyPI | 1.27.5 |
| pypdf2 | pypdf2_project | 1.27.5 |
Risk scores
Affected products
| Vendor | Product | Versions |
|---|---|---|
| py-pdf | PyPDF2 | < 1.27.5 |
| PyPI | PyPDF2 | 0 |
| py-pdf | PyPDF2 | 0 |
Timeline
- Apr 18, 2022 CVE Published
- Apr 19, 2022 EPSS Score (30 in total, the first dated here)
- Mar 9, 2026 Security Advisory (2 in total, the first dated here)
- Jun 17, 2026 CVE Updated
- Jul 2, 2026 Coalition ESS Score
Query this with the API
The same record, from the CLI:
vulnetix vdb vuln CVE-2022-24859
vulnetix vdb fixes CVE-2022-24859
Or with curl, using the org id and key from your account page:
curl -s -H "Authorization: ApiKey ${VULNETIX_ORG_ID}:${VULNETIX_API_KEY}" \
"https://api.vdb.vulnetix.com/v2/vuln/CVE-2022-24859/fixes/registry"
The Community plan is free and allows 50 queries a day. Get a free API key · API quickstart
References
- [debian-lts-announce] 20220603 [SECURITY] [DLA 3039-1] pypdf2 security update mailing-list
- [debian-lts-announce] 20230609 [SECURITY] [DLA 3451-1] pypdf2 security update mailing-list
- https://nvd.nist.gov/vuln/detail/CVE-2022-24859 advisory
- https://github.com/advisories/GHSA-xcjx-m2pj-8g79 advisory
- https://github.com/py-pdf/PyPDF2 url
- https://github.com/pypa/advisory-database/tree/main/vulns/pypdf2/PYSEC-2022-194.yaml advisory