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 __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"").
Attack profile
How easy it is to exploit
- Attack vector
- Local
- Complexity
- Low
- Privileges needed
- None
- User interaction
- None
What an attacker can affect
- Confidentiality
- None
- Integrity
- None
- Availability
- High
Exploit likelihood
What each source reports
CVE List Score used
6.2
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 __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"").
- Record
CVE-2023-36464- CVSS 3.1
- 6.2 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Weakness
- CWE-835
- Updated
- 2026-11-02
EUVDEUVD-2023-1690
6.2
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"").
- Record
EUVD-2023-1690- CVSS 3.1
- 6.2 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Updated
- 2026-11-03
GitHub AdvisoriesGHSA-4vvm-4w3v-6mr8
6.2
pypdf and PyPDF2 possible Infinite Loop when a comment isn't followed by a character
Impact
An 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.
Example Code and a PDF that causes the issue:
from pypdf import PdfReader
# 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
reader = PdfReader("MiFO_LFO_FEIS_NOA_Published.3.pdf")
page = reader.pages[0]
page.extract_text()
The issue was introduced with https://github.com/py-pdf/pypdf/pull/969
Patches
The issue was fixed with https://github.com/py-pdf/pypdf/pull/1828
Workarounds
It is recommended to upgrade to pypdf>=3.9.0. PyPDF2 users should migrate to pypdf.
If you cannot update your version of pypdf, you should modify pypdf/generic/_data_structures.py:
OLD: while peek not in (b"\r", b"\n"):
NEW: while peek not in (b"\r", b"\n", b""):
- Record
GHSA-4vvm-4w3v-6mr8- CVSS 3.1
- 6.2 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Weakness
- CWE-835
- Updated
- 2026-11-02
NVD
6.2
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"").
- Record
CVE-2023-36464- CVSS 3.1
- 6.2 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - CVSS 3.1
- 5.5 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H - Weakness
- CWE-835
- Updated
- 2026-11-02
OSV
6.2
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 __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"").
- Record
CVE-2023-36464- CVSS 3.1
- 6.2 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Weakness
- CWE-835
- Updated
- 2026-11-04
OSVDEBIAN-CVE-2023-36464
5.5
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"").
- Record
DEBIAN-CVE-2023-36464- CVSS 3.1
- 5.5 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H - Updated
- 2026-11-03
Show 6 moreShow less
OSVGHSA-4vvm-4w3v-6mr8
6.2
pypdf and PyPDF2 possible Infinite Loop when a comment isn't followed by a character
Impact
An 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.
Example Code and a PDF that causes the issue:
from pypdf import PdfReader
# 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
reader = PdfReader("MiFO_LFO_FEIS_NOA_Published.3.pdf")
page = reader.pages[0]
page.extract_text()
The issue was introduced with https://github.com/py-pdf/pypdf/pull/969
Patches
The issue was fixed with https://github.com/py-pdf/pypdf/pull/1828
Workarounds
It is recommended to upgrade to pypdf>=3.9.0. PyPDF2 users should migrate to pypdf.
If you cannot update your version of pypdf, you should modify pypdf/generic/_data_structures.py:
OLD: while peek not in (b"\r", b"\n"):
NEW: while peek not in (b"\r", b"\n", b""):
- Record
GHSA-4vvm-4w3v-6mr8- CVSS 3.1
- 6.2 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Weakness
- CWE-835
- Updated
- 2026-11-02
OSVPYSEC-2026-1835
6.2
pypdf and PyPDF2 possible Infinite Loop when a comment isn't followed by a character
Impact
An 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.
Example Code and a PDF that causes the issue:
from pypdf import PdfReader
# 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
reader = PdfReader("MiFO_LFO_FEIS_NOA_Published.3.pdf")
page = reader.pages[0]
page.extract_text()
The issue was introduced with https://github.com/py-pdf/pypdf/pull/969
Patches
The issue was fixed with https://github.com/py-pdf/pypdf/pull/1828
Workarounds
It is recommended to upgrade to pypdf>=3.9.0. PyPDF2 users should migrate to pypdf.
If you cannot update your version of pypdf, you should modify pypdf/generic/_data_structures.py:
OLD: while peek not in (b"\r", b"\n"):
NEW: while peek not in (b"\r", b"\n", b""):
- Record
PYSEC-2026-1835- CVSS 3.1
- 6.2 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Updated
- 2026-11-02
OSVPYSEC-2026-3008
6.2
pypdf and PyPDF2 possible Infinite Loop when a comment isn't followed by a character
Impact
An 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.
Example Code and a PDF that causes the issue:
from pypdf import PdfReader
# 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
reader = PdfReader("MiFO_LFO_FEIS_NOA_Published.3.pdf")
page = reader.pages[0]
page.extract_text()
The issue was introduced with https://github.com/py-pdf/pypdf/pull/969
Patches
The issue was fixed with https://github.com/py-pdf/pypdf/pull/1828
Workarounds
It is recommended to upgrade to pypdf>=3.9.0. PyPDF2 users should migrate to pypdf.
If you cannot update your version of pypdf, you should modify pypdf/generic/_data_structures.py:
OLD: while peek not in (b"\r", b"\n"):
NEW: while peek not in (b"\r", b"\n", b""):
- Record
PYSEC-2026-3008- CVSS 3.1
- 6.2 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Updated
- 2026-11-02
OSVRHLW-2026-821eaab8409c2a61
6.2
Lightwell Security Advisory: pypdf2 3.0.1+rhlw.1
Red Hat Lightwell has released pypdf2 3.0.1+rhlw.1 with a backported security fix.
CVE-2023-36464: Infinite Loop when a comment isn't followed by a character in pypdf
This patched artifact is a drop-in replacement for pypdf2 3.0.1 from PyPI.
- Record
RHLW-2026-821eaab8409c2a61- CVSS 3.1
- 6.2 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Updated
- 2026-11-02
OSVUBUNTU-CVE-2023-36464
6.2
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"").
- Record
UBUNTU-CVE-2023-36464- CVSS 3.1
- 6.2 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - CVSS 3.1
- 5.5 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H - Updated
- 2026-11-02
OSVROOT-APP-PYPI-CVE-2023-36464 No score
CVE-2023-36464 in rootio-PyPDF2 - Patched by Root
Root has patched CVE-2023-36464 in the rootio-PyPDF2 package for Root:PyPI. Multiple fixed versions available.
- Record
ROOT-APP-PYPI-CVE-2023-36464- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
pypdfPyPI |
3.1.0 up to 3.9.0 | 3.9.0 |
pypdf2PyPI |
2.2.0 to 3.0.1 | None known |
pypdfDebian:12 |
before 3.4.1-1+deb12u1, plus listed versions 3.4.1-1 |
3.4.1-1+deb12u1 |
pypdfDebian:13 |
before 3.17.4-1 | 3.17.4-1 |
pypdfDebian:14 |
before 3.17.4-1 | 3.17.4-1 |
pypdf2Debian:12 |
before 2.12.1-3+deb12u1, plus listed versions 2.12.1-3 |
2.12.1-3+deb12u1 |
pypdfPyPI |
3.1.0 up to 3.9.0, plus listed versions 3.2.03.2.13.3.03.4.03.4.1 Show 8 moreShow less3.5.03.5.13.5.23.6.03.7.03.7.13.8.03.8.1 |
3.9.0 |
pypdf2PyPI |
2.2.0 to 3.0.1, plus listed versions 2.10.02.10.12.10.22.10.32.10.4 Show 23 moreShow less2.10.52.10.62.10.72.10.82.10.92.11.02.11.12.11.22.12.02.12.12.2.12.3.02.3.12.4.02.4.12.4.22.5.02.6.02.7.02.8.02.8.12.9.03.0.0 |
None known |
pypdf2PyPI |
2.2.0 up to 3.9.0, plus listed versions 2.10.02.10.12.10.22.10.32.10.4 Show 24 moreShow less2.10.52.10.62.10.72.10.82.10.92.11.02.11.12.11.22.12.02.12.12.2.12.3.02.3.12.4.02.4.12.4.22.5.02.6.02.7.02.8.02.8.12.9.03.0.03.0.1 |
3.9.0 |
pypdf2Red Hat Lightwell:PyPI |
before 3.0.1+rhlw.1, plus listed versions 1.151.161.171.181.19 Show 45 moreShow less1.201.211.221.231.241.251.25.11.26.01.27.01.27.11.27.101.27.111.27.121.27.21.27.31.27.41.27.51.27.61.27.71.27.81.27.91.28.01.28.11.28.21.28.31.28.41.28.51.28.62.0.02.1.02.1.12.10.02.10.12.10.22.10.32.10.42.10.52.10.62.10.72.10.82.10.92.11.02.11.12.11.22.12.0 |
3.0.1+rhlw.1 |
Show 6 moreShow less
| Package | Affected | Fixed |
|---|---|---|
rootio-PyPDF2Root:PyPI |
before 3.0.1+root.io.1 | 3.0.1+root.io.13.0.1+root.io.2 |
PyPDF2Root:PyPI |
before 3.0.1+aikido.2 | 3.0.1+aikido.2 |
pypdfUbuntu:24.04:LTS |
All versions, plus listed versions 3.4.1-13.17.4-14.0.0-14.0.1-14.0.2-1 |
None known |
pypdfUbuntu:25.10 |
All versions, plus listed versions 4.3.1-15.4.0-1 |
None known |
pypdfUbuntu:26.10 |
All versions, plus listed versions 6.9.2-16.9.2-2 |
None known |
pypdfUbuntu:26.04:LTS |
All versions, plus listed versions 5.4.0-16.9.2-1 |
None known |
History
| Recorded | Changed | Sources |
|---|---|---|
| facts | OSV | |
| aliases, published | EUVD | |
| first indexed | CVE List, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2023-36464 is a medium vulnerability (CVSS 6.2) in Py-pdf Pypdf, published June 27, 2023. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.35%, the 29th percentile. Fixed in pypdf 3.9.0.
References
github.com/py-pdf/pypdf/security/advisories/GHSA-4vvm-4w3v-6mr8
github.com/py-pdf/pypdf/pull/1828
github.com/py-pdf/pypdf/pull/969
nvd.nist.gov/vuln/detail/CVE-2023-36464
github.com/py-pdf/pypdf/commit/b0e5c689df689ab173df84dacd77b6fc3c161932
github.com/py-pdf/pypdf/releases/tag/3.9.0
Show 8 moreShow less
github.com/advisories/GHSA-4vvm-4w3v-6mr8
github.com/CVEProject/cvelistV5/tree/main/cves/2023/36xxx/CVE-2023-36464.json
security-tracker.debian.org/tracker/CVE-2023-36464
github.com/py-pdf/pypdf
pypi.org/project/pypdf2
pypi.org/project/pypdf
ubuntu.com/security/CVE-2023-36464
cve.org/CVERecord?id=CVE-2023-36464
Left out here: 16 versions. The JSON record has them.