6.8medium
pypdf: manipulated stream length values can exhaust RAM
- Severity
- 6.8medium CVSS:4.0 by GitHub_M
- Exploit likelihood
- 0.20% (higher than 10% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-hqmh-ppp3-xvm7PYSEC-2026-3019
Description
pypdf is a free and open-source pure-python PDF library. Prior to 6.8.0, an attacker who uses this vulnerability can craft a PDF which leads to large memory usage. This requires parsing a content stream with a rather large /Length value, regardless of the actual data length inside the stream. This vulnerability is fixed in 6.8.0.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| py-pdf pypdf | < 6.8.0, before 6.8.0 | CVE List, NVD |
| pypdf (PyPI) | before 6.8.0 | GitHub Advisory Database, PyPA Advisory Database |
All scores
| GitHub_M | 6.8medium CVSS:4.0 | CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N |
| GitHub | medium CVSS:4.0 | CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N |
| NVD | 5.5medium CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H |
| PyPA Advisory Database | Not scored CVSS:4.0 | CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N |
Classification
SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.
What each source says
CVE List
pypdf is a free and open-source pure-python PDF library. Prior to 6.8.0, an attacker who uses this vulnerability can craft a PDF which leads to large memory usage. This requires parsing a content stream with a rather large /Length value, regardless of the actual data length inside the stream. This vulnerability is fixed in 6.8.0.
GitHub Advisory Database
Impact
An attacker who uses this vulnerability can craft a PDF which leads to large memory usage. This requires parsing a content stream with a rather large /Length value, regardless of the actual data length inside the stream.
Patches
This has been fixed in pypdf==6.8.0.
Workarounds
If you cannot upgrade yet, consider applying the changes from PR #3675.
As far as we are aware, this mostly affects reading from buffers of unknown size, as returned by open("file.pdf", mode="rb") for example. Passing a file path or a BytesIO buffer to pypdf instead does not seem to trigger the vulnerability.
NVD (es)
pypdf es una biblioteca PDF pura de Python, gratuita y de código abierto. Antes de la 6.8.0, un atacante que explota esta vulnerabilidad puede crear un PDF que provoca un gran consumo de memoria. Esto requiere analizar una secuencia de contenido con un valor /Length bastante grande, independientemente de la longitud real de los datos dentro de la secuencia. Esta vulnerabilidad está corregida en la 6.8.0.
References
| https://github.com/py-pdf/pypdf/security/advisories/GHSA-hqmh-ppp3-xvm7 | patch, vendor-advisory, web | |
| https://github.com/py-pdf/pypdf/pull/3675 | issue-tracking, patch, web | |
| https://github.com/py-pdf/pypdf/releases/tag/6.8.0 | product, release-notes, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2026-31826 | advisory | |
| https://github.com/py-pdf/pypdf/commit/3c550b3196adeba1506a26e57c09c09fac75e9aa | web | |
| https://github.com/py-pdf/pypdf | package | |
| https://pypi.org/project/pypdf | package | |
| https://github.com/advisories/GHSA-hqmh-ppp3-xvm7 | advisory | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-31826 changed 2026-03-11 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-hqmh-ppp3-xvm7 changed 2026-09-10 | CC-BY-4.0 |
| NVD | CVE-2026-31826 changed 2026-11-02 | Public domain |
| PyPA Advisory Database | PYSEC-2026-3019 changed 2026-07-13 | CC-BY-4.0 |