CVE-2026-40260
Description
A flaw was found in pypdf, a pure-python PDF library. A remote attacker can exploit this vulnerability by crafting a malicious PDF file containing manipulated XMP metadata entity declarations, which are data embedded within a PDF file. When the affected system parses this metadata, it can lead to excessive memory consumption. This memory exhaustion can result in a Denial of Service (DoS) condition, making the application or system unresponsive.
Statement
Red Hat rates this vulnerability as Moderate impact with a CVSS score of 6.5. The vulnerable code is in pypdf's XMP metadata parser, which only runs when application code calls reader.xmp_metadata. Opening a PDF or extracting text does not trigger it. Red Hat products ship pypdf through LlamaIndex, which calls extract_text() and page_labels but never accesses XMP metadata. The vulnerable parser does not run in normal operation. Exploitation requires delivering a crafted PDF to an application that reads XMP metadata from untrusted files. If triggered, quadratic entity expansion can exhaust available memory. Red Hat ships these components in containers with memory limits, where this causes an OOM kill rather than gradual degradation.
Mitigation
Do not call reader.xmp_metadata on untrusted PDF input. The standard PDF metadata property (reader.metadata) uses a separate code path and is not affected. If you must process XMP metadata from untrusted PDFs, set memory limits on the process or container to contain the impact of a potential denial of service.
Common Vulnerability Scoring System (CVSS) Score Details
Info alert:Important note
CVSS scores for open source components depend on vendor-specific factors (e.g. version or build chain). Therefore, Red Hat's score and impact rating can be different from NVD and other vendors. Red Hat remains the authoritative CVE Naming Authority (CNA) source for its products and services (see Red Hat classifications).
The following CVSS metrics and score provided are preliminary and subject to review.
CVSS v3 Score Breakdown
| Red Hat | NVD | cve.org | |
|---|---|---|---|
| Base Score | 6.5 | 5.3 | N/A |
| Attack Vector | Network | Network | N/A |
| Attack Complexity | Low | Low | N/A |
| Privileges Required | None | None | N/A |
| User Interaction | Required | None | N/A |
| Scope | Unchanged | Unchanged | N/A |
| Confidentiality | None | None | N/A |
| Integrity Impact | None | None | N/A |
| Availability Impact | High | Low | N/A |
Vector
Red Hat: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H
NVD: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
Red Hat CVSS v3 Score Explanation
UI:R: pypdf's XMP metadata parser only runs when code calls reader.xmp_metadata, not when opening a PDF. Red Hat products ship pypdf through LlamaIndex, which only calls extract_text() and page_labels. The XMP parser never executes. NIST scored UI:N because pypdf is a library and they can't assume how downstream consumers use it.
A:H: upstream describes "large memory usage" from quadratic entity expansion (expat blocks the exponential case). NIST read this as A:L. Red Hat ships pypdf inside containers with memory limits, so quadratic expansion triggers an OOM kill, not a slowdown.
Understanding the Weakness (CWE)
Availability
Technical Impact: DoS: Resource Consumption (Other)
If parsed, recursive entity references allow the attacker to expand data exponentially, quickly consuming all system resources.
Frequently Asked Questions
Not sure what something means? Check out our Security Glossary.
Want to get errata notifications? Sign up here.