Security (5/5): outline cycle + XMP entity expansion — CVE-2026-24688, CVE-2026-40260#5
Open
icanhasmath wants to merge 2 commits into
Open
Security (5/5): outline cycle + XMP entity expansion — CVE-2026-24688, CVE-2026-40260#5icanhasmath wants to merge 2 commits into
icanhasmath wants to merge 2 commits into
Conversation
A crafted document outline whose /Next chain loops back to an already-visited node made PdfReader._get_outlines walk forever (CWE-835). Track visited node ids; stop (with a warning) on a repeat, and pass a copy of the visited set into the /First sub-outline recursion so shared sub-trees still render. The new visited parameter is a trailing keyword default, so the public signature is unchanged. Mirrors upstream pypdf 6.6.2 (PR py-pdf#3610). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
XmpInformation parsed untrusted XMP metadata with xml.dom.minidom parseString, which permits XML entity declarations. libexpat blocks exponential expansion but not quadratic expansion, so a crafted XMP packet could exhaust memory (CWE-776). Parse via a namespace-aware ExpatBuilderNS subclass that installs an EntityDeclHandler rejecting any entity declaration with ExpatError. Mirrors upstream pypdf 6.10.0 (PR py-pdf#3724); xml.dom.expatbuilder is available on Python 2.7. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 5 of 5 of the PyPDF2 1.28.6 security backport, targeting
1.28.6.x._reader.py/Nextwalk against cyclesxmp.pyBackported from upstream pypdf 6.6.2 / 6.10.0; Py2.7-safe (
xml.dom.expatbuilderis available on 2.7). New tests:Tests/test_security_outline.py,Tests/test_security_xmp.py(3). Validated under Python 2.7.18 — no regressions.🤖 Generated with Claude Code