{"id":"CVE-2026-31826","aliases":["GHSA-hqmh-ppp3-xvm7","PYSEC-2026-3019"],"title":"pypdf: manipulated stream length values can exhaust RAM","summary":"pypdf: manipulated stream length values can exhaust RAM","severity":"medium","vendor":"pypdf","product":"pypdf","ecosystem":"pip","affected":["pypdf < 6.8.0"],"patched":["pypdf 6.8.0"],"published":"2026-03-11","updated":"2026-09-10","sourceUpdated":"2026-09-10T03:50:39.503255117Z","source":"OSV","sourceUrl":"https://osv.dev/vulnerability/GHSA-hqmh-ppp3-xvm7","references":[{"url":"https://github.com/py-pdf/pypdf/security/advisories/GHSA-hqmh-ppp3-xvm7"},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-31826"},{"url":"https://github.com/py-pdf/pypdf/pull/3675"},{"url":"https://github.com/py-pdf/pypdf/commit/3c550b3196adeba1506a26e57c09c09fac75e9aa"},{"url":"https://github.com/py-pdf/pypdf"},{"url":"https://github.com/py-pdf/pypdf/releases/tag/6.8.0"}],"tags":["osv","pip"],"epss":0.00179,"epssPercentile":0.06657,"ingestedAt":"2026-07-13T18:57:59.353Z","slug":"CVE-2026-31826","body":"## Overview\n\n### Impact\n\nAn 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.\n\n### Patches\nThis has been fixed in [pypdf==6.8.0](https://github.com/py-pdf/pypdf/releases/tag/6.8.0).\n\n### Workarounds\nIf you cannot upgrade yet, consider applying the changes from PR [#3675](https://github.com/py-pdf/pypdf/pull/3675).\n\nAs 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.\n\n## Affected packages\n\n- `pypdf < 6.8.0`\n\n## Remediation\n\nUpgrade to a patched release:\n\n- `pypdf 6.8.0`","depth":"sunlit","depthScore":28,"depthScoreParts":{"impact":27.5,"likelihood":0,"exploitation":0,"ransomware":0},"changes":[]}