CVE-2025-64506
📋 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
- libpng
- Any software using vulnerable libpng versions
📦 What is this software?
Libpng by Libpng
⚠️ 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.
🎯 Exploit Status
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
allDisable the convert_to_8bit option in applications using libpng's simplified write API
Application-specific configuration changes required
Input validation
allImplement 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"