CVE-2026-40260: pypdf Manipulated XMP Metadata Entity Declarations Vulnerability

MODERATE
Advisory Identifier: GHSA-3crg-w4f6-42mx
CVSS 5.3
CWE-776
Published
Advisory Summary

CVE-2026-40260 is a MODERATE (CVSS 5.3) manipulated xmp metadata entity declarations vulnerability (CWE-776: Improper Restriction of Recursive Entity References in DTDs ('XML Entity Expansion')) affecting pypdf libraries in the PyPI ecosystem. The issue involves manipulated xmp metadata entity declarations can exhaust ram. Remediation is available by upgrading affected packages to version 6.10.0.

CVE-2026-40260 at a Glance

CVE Identifier CVE-2026-40260
GHSA Identifier GHSA-3crg-w4f6-42mx
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-776: Improper Restriction of Recursive Entity References in DTDs ('XML Entity Expansion')
Affected Product pypdf
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 5.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability Low (A:L)

How to Fix CVE-2026-40260

To remediate this vulnerability, upgrade all affected pypdf dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

pypdf fixed: 6.10.0
pip install pypdf>=6.10.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show pypdf

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-40260, inspect your installed packages using pip:

pip show pypdf

Analyze the terminal output to locate any version of pypdf in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 6.10.0), your application is affected.

Note: The pip show pypdf command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-776: Improper Restriction of Recursive Entity References in DTDs ('XML Entity Expansion'), where the product uses xml documents and allows their structure to be defined with a document type definition (dtd), but it does not properly control the number of recursive definitions of entities. In pypdf, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact An attacker who uses this vulnerability can craft a PDF which leads to large memory usage. This requires parsing the XMP metadata. ### Patches This has been fixed in [pypdf==6.10.0](https://github.com/py-pdf/pypdf/releases/tag/6.10.0). ### Workarounds If you cannot upgrade yet, consider applying the changes from PR [#3724](https://github.com/py-pdf/pypdf/pull/3724).

CVE-2026-40260 Affected pypdf Versions

1 component(s)
Fixed Versions:
6.10.0
Product / Package Ecosystem Affected Versions Fixed Version
pypdf
PyPI
< 6.10.0
6.10.0

References

Frequently Asked Questions

What is CVE-2026-40260?
CVE-2026-40260 is a security vulnerability in pypdf involving Manipulated XMP metadata entity declarations can exhaust RAM under CWE-776: Improper Restriction of Recursive Entity References in DTDs ('XML Entity Expansion').
Which pypdf versions are affected?
Affected versions include releases prior to 6.10.0 across affected packages: pypdf.
What version fixes CVE-2026-40260?
Upgrading to 6.10.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is pypdf affected?
Yes, pypdf is affected in releases prior to 6.10.0. Upgrade your dependency to 6.10.0 or later.
What is the CVSS score of CVE-2026-40260?
CVE-2026-40260 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L.
What CWE is associated with CVE-2026-40260?
CVE-2026-40260 is classified under CWE-776: Improper Restriction of Recursive Entity References in DTDs ('XML Entity Expansion') (The product uses XML documents and allows their structure to be defined with a Document Type Definition (DTD), but it does not properly control the number of recursive definitions of entities.).
How can I check PyPI dependencies for CVE-2026-40260?
Run the dependency tree command: 'pip show pypdf'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-3crg-w4f6-42mx",
  "modified" : "2026-04-24T20:37:32Z",
  "published" : "2026-04-10T20:59:36Z",
  "aliases" : [ "CVE-2026-40260" ],
  "summary" : "pypdf: Manipulated XMP metadata entity declarations can exhaust RAM",
  "details" : "### Impact\n\nAn attacker who uses this vulnerability can craft a PDF which leads to large memory usage. This requires parsing the XMP metadata.\n\n### Patches\nThis has been fixed in [pypdf==6.10.0](https://github.com/py-pdf/pypdf/releases/tag/6.10.0).\n\n### Workarounds\nIf you cannot upgrade yet, consider applying the changes from PR [#3724](https://github.com/py-pdf/pypdf/pull/3724).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "pypdf"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "6.10.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/py-pdf/pypdf/security/advisories/GHSA-3crg-w4f6-42mx"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-40260"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/py-pdf/pypdf/pull/3724"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/py-pdf/pypdf/commit/b15a374e5ca648d4878e57c3b2c0551e7f8cc7f8"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/py-pdf/pypdf"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/py-pdf/pypdf/releases/tag/6.10.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-776" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-10T20:59:36Z",
    "nvd_published_at" : "2026-04-17T01:17:39Z"
  }
}