CVE-2026-31826: pypdf: manipulated stream length values can exhaust RAM

Published Mar 10, 2026
·
Updated

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.

Other sources

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.

MITRE

Affected Software

3 affected componentsFixes available
pypi/pypdf<6.8.0
pip/pypdf<6.8.0
6.8.0
Pypdf Project Pypdf<6.8.0

Event History

Mar 10, 2026
CVE Published
via MITRE·09:36 PM
Data Sourced
via MITRE·09:36 PM
DescriptionWeakness
Data Sourced
via NVD·10:16 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·10:16 PM
RemedyAffected Software
Mar 11, 2026
Advisory Published
via GitHub·12:14 AM
Data Sourced
via GitHub·12:14 AM
DescriptionWeaknessAffected Software
Nov 20, 58180
Event
via FIRST·02:24 PM
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-31826?

CVE-2026-31826 has a high severity rating due to its potential to cause significant memory exhaustion.

2

How do I fix CVE-2026-31826?

To fix CVE-2026-31826, update to pypdf version 6.8.0 or later.

3

What type of attack does CVE-2026-31826 enable?

CVE-2026-31826 enables attackers to craft PDFs that can lead to excessive RAM usage.

4

Which versions of pypdf are affected by CVE-2026-31826?

Versions of pypdf prior to 6.8.0 are affected by CVE-2026-31826.

5

What is the impact of CVE-2026-31826?

The impact of CVE-2026-31826 is that it allows for memory exhaustion when parsing PDF content streams with manipulated length values.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203