Junglewise Threat Intelligence

CVE-2026-40260: pypdf: Manipulated XMP metadata entity declarations can exhaust RAM

CVE-2026-40260 · Severity: medium · CVSS 5.3 · Published 2026-04-10

Technologies: Py-Pdf Pypdf. Vendors: PyPI.

Executive brief

pypdf is a Python library for reading and manipulating PDF files. An attacker can craft a malicious PDF with specially crafted XMP metadata containing recursive entity declarations that cause the library to consume excessive RAM during parsing, leading to denial of service or application crashes.

Technical details

This vulnerability is a classic XML Entity Expansion (XXE) attack, specifically CWE-776, where an attacker manipulates DTD entity declarations in XMP metadata within a PDF file. When pypdf parses the XMP metadata, it fails to properly restrict recursive entity references, causing exponential memory expansion. The attack requires only the ability to craft and deliver a malicious PDF file—no authentication or user interaction is needed beyond the application parsing the PDF. An attacker can exhaust available RAM, causing the application to hang or crash. The vulnerability was fixed in pypdf version 6.10.0 via PR #3724, which properly constrains entity expansion during XML parsing.

Affected products

  • py-pdf pypdf before 6.10.0

Timeline

  • 2026-04-10: disclosed: GHSA-3crg-w4f6-42mx published
  • 2026-04-10: patched: Fixed in pypdf 6.10.0

References

Related threats