CVE-2025-64506

6.1 MEDIUM

📋 TL;DR

A heap buffer over-read vulnerability in libpng's png_write_image_8bit function allows reading up to 2 bytes beyond allocated memory boundaries when processing 8-bit images with convert_to_8bit enabled. This affects applications using libpng version 1.6.0 through 1.6.50 to write PNG images. Attackers could potentially exploit this to leak sensitive memory contents or cause application crashes.

💻 Affected Systems

Products:
  • libpng
  • Any software using vulnerable libpng versions
Versions: 1.6.0 to 1.6.50
Operating Systems: All platforms using libpng
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects applications using the simplified write API with convert_to_8bit enabled for 8-bit grayscale+alpha, RGB/RGBA, or images with incomplete row data.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Information disclosure through memory leakage, potential remote code execution if combined with other vulnerabilities, or denial of service through application crashes.

🟠

Likely Case

Application crashes or instability when processing malicious PNG files, potentially leading to denial of service.

🟢

If Mitigated

Minimal impact with proper input validation and memory protection mechanisms in place.

🌐 Internet-Facing: MEDIUM - Applications processing user-uploaded PNG files are vulnerable, but exploitation requires specific conditions.
🏢 Internal Only: LOW - Requires processing of malicious PNG files, which is less likely in controlled internal environments.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ⚠️ Yes
Complexity: MEDIUM

Exploitation requires crafting specific PNG files that trigger the vulnerable code path. No public exploits have been reported as of current knowledge.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 1.6.51

Vendor Advisory: https://github.com/pnggroup/libpng/security/advisories/GHSA-qpr4-xm66-hww6

Restart Required: Yes

Instructions:

1. Download libpng 1.6.51 from official sources. 2. Replace existing libpng installation. 3. Recompile any applications statically linked to libpng. 4. Restart affected services.

🔧 Temporary Workarounds

Disable convert_to_8bit

all

Disable the convert_to_8bit option in applications using libpng's simplified write API

Application-specific configuration changes required

Input validation

all

Implement strict validation of PNG files before processing

Implement file validation in application code

🧯 If You Can't Patch

  • Implement network-level filtering to block PNG files from untrusted sources
  • Use application sandboxing or containerization to limit potential impact

🔍 How to Verify

Check if Vulnerable:

Check libpng version with: pngtest --version or examine library files

Check Version:

pngtest --version 2>/dev/null | head -1

Verify Fix Applied:

Verify version is 1.6.51 or higher: pngtest --version | grep -q '1.6.5[1-9]\|1.6.[6-9]\|1.[7-9]'

📡 Detection & Monitoring

Log Indicators:

  • Application crashes when processing PNG files
  • Memory access violation errors
  • Segmentation faults in libpng-related processes

Network Indicators:

  • Unusual PNG file uploads to web applications
  • Multiple failed PNG processing attempts

SIEM Query:

source="application_logs" AND ("segmentation fault" OR "memory violation") AND "libpng"

🔗 References

📤 Share & Export