CVE-2023-36464 Infinite Loop when a comment isn't followed by a character in pypdf
An attacker can cause a denial of service via infinite loop in pypdf by crafting a specific PDF file that triggers the vulnerability during text extraction.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Local or same network only
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2023-36464?
CVE-2023-36464 is a medium-severity denial of service vulnerability in Pypdf Project Pypdf, published on 27 Jun 2023. It can only be exploited from the same machine or local network, with no action from the victim.
Official description
pypdf is an open source, pure-python PDF library. In affected versions an attacker may craft a PDF which leads to an infinite loop if `__parse_content_stream` is executed. That is, for example, the case if the user extracted text from such a PDF. This issue was introduced in pull request #969 and resolved in pull request #1828. Users are advised to upgrade. Users unable to upgrade may modify the line `while peek not in (b"\r", b"\n")` in `pypdf/generic/_data_structures.py` to `while peek not in (b"\r", b"\n", b"")`.
Weakness: CWE-835
Which versions are affected by CVE-2023-36464?
6 open source packages ship an affected version, including pypdf, PyPDF2 and pypdf2. It affects 2 products.
| Package | Affected | Fixed in |
|---|---|---|
pypdf PyPI | From 3.1.0 | 3.9.0 |
pypdf PyPI | From 3.1.0 | 3.9.0 |
pypdf PyPI | From 3.1.0 | 3.9.0 |
PyPDF2 PyPI | From 2.2.0 to 3.0.1 | None |
pypdf2 PyPI | From 2.2.0 to 3.0.1 | None |
pypdf2 PyPI | From 2.2.0 | 3.9.0 |
Products include Pypdf2 Project Pypdf2, Pypdf Project Pypdf.
How do I fix CVE-2023-36464?
Upgrade pypdf to 3.9.0 or later.
Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.
Is CVE-2023-36464 being exploited?
It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-36464 exists.
Sources
Also known as DEBIAN-CVE-2023-36464, GHSA-4vvm-4w3v-6mr8, PYSEC-2026-1835, PYSEC-2026-3008, RHLW-2026-821eaab8409c2a61, ROOT-APP-PYPI-CVE-2023-36464 and 1 more.