CVE-2025-64720
📋 TL;DR
This CVE describes an out-of-bounds read vulnerability in LIBPNG library versions 1.6.0 through 1.6.50. When processing palette images with PNG_FLAG_OPTIMIZE_ALPHA enabled, the library incorrectly applies background compositing during premultiplication, potentially allowing attackers to read memory beyond allocated buffers. Applications using the affected LIBPNG versions to process PNG images are vulnerable.
💻 Affected Systems
- LIBPNG (libpng library)
- Applications using libpng for PNG image processing
📦 What is this software?
Libpng by Libpng
⚠️ Risk & Real-World Impact
Worst Case
Information disclosure through memory leakage, potentially exposing sensitive data or application memory contents to attackers.
Likely Case
Application crashes (denial of service) or information leakage of adjacent memory contents.
If Mitigated
Minimal impact if proper input validation and memory protections are in place.
🎯 Exploit Status
Exploitation requires crafting malicious PNG images and the specific flag configuration. No public exploits currently available.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 1.6.51
Vendor Advisory: https://github.com/pnggroup/libpng/security/advisories/GHSA-hfc7-ph9c-wcww
Restart Required: Yes
Instructions:
1. Download libpng 1.6.51 from official sources. 2. Replace existing libpng installation. 3. Recompile applications using libpng. 4. Restart affected services.
🔧 Temporary Workarounds
Disable PNG_FLAG_OPTIMIZE_ALPHA
allDisable the vulnerable flag in applications using libpng
Modify application code to avoid setting PNG_FLAG_OPTIMIZE_ALPHA when processing palette images
🧯 If You Can't Patch
- Implement strict input validation for PNG images
- Use alternative image processing libraries for PNG handling
🔍 How to Verify
Check if Vulnerable:
Check libpng version with: pngtest --version or check library files for version 1.6.0-1.6.50
Check Version:
pngtest --version 2>/dev/null | grep -o 'libpng [0-9.]*'
Verify Fix Applied:
Verify libpng version is 1.6.51 or higher
📡 Detection & Monitoring
Log Indicators:
- Application crashes during PNG processing
- Memory access violation errors in application logs
Network Indicators:
- Unusual PNG file uploads to web applications
- Repeated PNG processing failures
SIEM Query:
source="application.log" AND ("segmentation fault" OR "memory violation" OR "libpng") AND "png"
🔗 References
- https://github.com/pnggroup/libpng/commit/08da33b4c88cfcd36e5a706558a8d7e0e4773643
- https://github.com/pnggroup/libpng/issues/686
- https://github.com/pnggroup/libpng/pull/751
- https://github.com/pnggroup/libpng/security/advisories/GHSA-hfc7-ph9c-wcww
- https://github.com/pnggroup/libpng/security/advisories/GHSA-hfc7-ph9c-wcww