CVE-2023-36464: Infinite Loop when a comment isn't followed by a character in pypdf
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 parsecontentstream 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/datastructures.py to while peek not in (b"\r", b"\n", b"").
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
debian/pypdfto a version that resolves this vulnerability.Fixed in 3.4.1-1+deb12u1 - Upgrade
Upgrade
debian/pypdfto a version that resolves this vulnerability.Fixed in 3.17.4-1 - Upgrade
Upgrade
debian/pypdf2to a version that resolves this vulnerability.Fixed in 2.12.1-3+deb12u1 - Upgrade
Upgrade
debian/pypdfto a version that resolves this vulnerability.Fixed in 3.4.1-1+deb12u1Fixed in 5.4.0-1Fixed in 6.21.1-1Fixed in 6.21.4-1 - Configuration
If unable to upgrade, modify the loop condition in pypdf/generic/_data_structures.py from `while peek not in (b"\r", b"\n")` to `while peek not in (b"\r", b"\n", b"")`.
pypdf (pypdf/generic/_data_structures.py) - __parse_content_stream while peek not in (b"\r", b"\n") = while peek not in (b"\r", b"\n", b"")