{"id":"CVE-2023-36464","aliases":["CVE-2023-36464","GHSA-4vvm-4w3v-6mr8","PYSEC-2026-1835","PYSEC-2026-3008"],"related":[],"kind":"vulnerability","state":"published","title":"Infinite Loop when a comment isn't followed by a character in pypdf","summary":"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\"\")`.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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\"\")`.","source":"cvelist"},{"lang":"en","text":"### Impact\nAn attacker who uses this vulnerability can craft a PDF which leads to an infinite loop if `__parse_content_stream` is executed. This infinite loop blocks the current process and can utilize a single core of the CPU by 100%. It does not affect memory usage. That is, for example, the case if the user extracted text from such a PDF.\n\nExample Code and a PDF that causes the issue:\n\n```python\nfrom pypdf import PdfReader\n\n# https://objects.githubusercontent.com/github-production-repository-file-5c1aeb/3119517/11367871?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20230627%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230627T201018Z&X-Amz-Expires=300&X-Amz-Signature=d71c8fd9181c4875f0c04d563b6d32f1d4da6e7b2e6be2f14479ce4ecdc9c8b2&X-Amz-SignedHeaders=host&actor_id=1658117&key_id=0&repo_id=3119517&response-content-disposition=attachment%3Bfilename%3DMiFO_LFO_FEIS_NOA_Published.3.pdf&response-content-type=application%2Fpdf\nreader = PdfReader(\"MiFO_LFO_FEIS_NOA_Published.3.pdf\")\npage = reader.pages[0]\npage.extract_text()\n```\n\nThe issue was introduced with https://github.com/py-pdf/pypdf/pull/969\n\n### Patches\n\nThe issue was fixed with https://github.com/py-pdf/pypdf/pull/1828\n\n### Workarounds\n\nIt is recommended to upgrade to `pypdf>=3.9.0`. PyPDF2 users should migrate to pypdf.\n\nIf you cannot update your version of pypdf, you should modify `pypdf/generic/_data_structures.py`:\n\n```\nOLD: while peek not in (b\"\\r\", b\"\\n\"):\nNEW: while peek not in (b\"\\r\", b\"\\n\", b\"\"):\n```","format":"markdown","source":"ghsa"}],"published":"2023-06-27T21:24:30.685Z","modified":"2026-11-02T16:06:04.477Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":6.2,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":6.2,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":6.2,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H","score":5.5,"rating":"MEDIUM"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":6.2,"rating":"MEDIUM"}],"cwes":["CWE-835"],"affected":[{"ranges":[{"version":" pypdf: < 3.90","status":"affected"},{"version":"PyPDF2: >= 2.2.0","status":"affected"}],"vendor":"py-pdf","product":"pypdf","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"3.1.0","status":"affected","fixed":"3.9.0"}],"ecosystem":"PyPI","package":"pypdf","purl":"pkg:pypi/pypdf","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"2.2.0","status":"affected","lastAffected":"3.0.1"}],"ecosystem":"PyPI","package":"pypdf2","purl":"pkg:pypi/pypdf2","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"3.9.0"}],"vendor":"py-pdf","product":"pypdf","cpe":"cpe:2.3:a:py-pdf:pypdf:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"status":"affected","introduced":"2.2.0"}],"vendor":"pypdf2_project","product":"pypdf2","cpe":"cpe:2.3:a:pypdf2_project:pypdf2:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"2.2.0","status":"affected","fixed":"3.9.0"}],"ecosystem":"PyPI","package":"pypdf2","purl":"pkg:pypi/pypdf2","source":"pysec"},{"ranges":[{"type":"ecosystem","introduced":"3.1.0","status":"affected","fixed":"3.9.0"}],"ecosystem":"PyPI","package":"pypdf","purl":"pkg:pypi/pypdf","source":"pysec"}],"references":[{"url":"https://github.com/py-pdf/pypdf/security/advisories/GHSA-4vvm-4w3v-6mr8","tags":["exploit","patch","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/py-pdf/pypdf/pull/1828","tags":["patch","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/py-pdf/pypdf/pull/969","tags":["issue-tracking","patch","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2023-36464","tags":["advisory"],"sources":["ghsa","pysec"]},{"url":"https://github.com/py-pdf/pypdf/commit/b0e5c689df689ab173df84dacd77b6fc3c161932","tags":["fix","web"],"sources":["ghsa","pysec"]},{"url":"https://github.com/py-pdf/pypdf","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://github.com/py-pdf/pypdf/releases/tag/3.9.0","tags":["web"],"sources":["ghsa","pysec"]},{"url":"https://pypi.org/project/pypdf2","tags":["package"],"sources":["pysec"]},{"url":"https://github.com/advisories/GHSA-4vvm-4w3v-6mr8","tags":["advisory"],"sources":["pysec"]},{"url":"https://pypi.org/project/pypdf","tags":["package"],"sources":["pysec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2024-12-03T16:55:56.361Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2023-36464","url":"https://www.cve.org/CVERecord?id=CVE-2023-36464","licence":"CVE Terms of Use","modified":"2024-12-03T16:56:06.186Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-4vvm-4w3v-6mr8","url":"https://github.com/advisories/GHSA-4vvm-4w3v-6mr8","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:01.918Z"},{"source":"nvd","name":"NVD","id":"CVE-2023-36464","url":"https://nvd.nist.gov/vuln/detail/CVE-2023-36464","licence":"Public domain","modified":"2026-11-02T16:06:04.477Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-1835","url":"https://osv.dev/vulnerability/PYSEC-2026-1835","licence":"CC-BY-4.0","modified":"2026-07-13T16:42:55.319Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-3008","url":"https://osv.dev/vulnerability/PYSEC-2026-3008","licence":"CC-BY-4.0","modified":"2026-07-13T16:42:55.319Z"}],"updatedAt":"2026-11-25T22:58:25.260Z","epss":{"score":0.00352,"percentile":0.30892,"date":"2026-12-01T12:00:22.000Z"}}