CVE-2026-27024: pypdf Infinite Loop Vulnerability in TreeObject Processing

pypdf Updated 23 Feb 2026

Summary

18/02/2026
Yes i
Moderate
6.9

CVE-2026-27024: pypdf has a possible infinite loop when processing TreeObject. Affects pypdf versions < 6.7.1. Fixed in 6.7.1. How to fix ↓

Also tracked for

The same CVE-2026-27024 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

pypdf is a popular Python library used for manipulating PDF files. It allows users to create, modify, and extract information from PDF documents. The library is widely utilized in various applications due to its ease of use and comprehensive functionality. However, it has a vulnerability that can lead to an infinite loop when processing certain PDF structures, specifically TreeObjects, which are often used in document outlines.

Vulnerability Detail

The vulnerability arises from the way pypdf handles TreeObjects. An attacker can craft a malicious PDF that, when processed, leads to an infinite loop. This occurs when the library attempts to access the children of a TreeObject, potentially causing the application to hang indefinitely. The implications of this vulnerability can be severe, as it may lead to denial of service, impacting the usability of applications that rely on pypdf for PDF processing.

How To Fix

Latest published version: 6.21.2 as of 22 Oct 2026

pip install --upgrade "pypdf==6.21.2"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

6.7.1

This is the first release that contains the fix.

pip install --upgrade "pypdf==6.7.1"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If you are unable to upgrade to the patched version immediately, you can apply the changes from pull request #3645. This involves modifying the code to handle TreeObject processing more safely. The specific changes can be found in the pull request on GitHub: https://github.com/py-pdf/pypdf/pull/3645.

Conclusion

The pypdf library has a vulnerability that can lead to an infinite loop when processing TreeObjects in PDFs. It is crucial for users to upgrade to version 6.7.1 to mitigate this risk. For those unable to upgrade immediately, applying the changes from the relevant pull request can serve as a temporary solution.

See every vulnerability recorded for pypdf →

Share this vulnerability

FAQ

The vulnerability allows for an infinite loop when processing certain PDF structures, specifically TreeObjects.

You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

The main consequence is a denial of service, as the application may hang indefinitely when processing a malicious PDF.

Yes, the vulnerability has been fixed in pypdf version 6.7.1. It is recommended to upgrade to this version.

If you cannot upgrade, consider applying the changes from pull request #3645 as a temporary workaround.

Related vulnerabilities

Recent vulnerabilities recorded for pypdf.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Latest published version: 6.21.2 as of 22 Oct 2026

pip install --upgrade "pypdf==6.21.2"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

6.7.1

This is the first release that contains the fix.

pip install --upgrade "pypdf==6.7.1"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback