CVE-2020-28248
📋 TL;DR
CVE-2020-28248 is an integer overflow vulnerability in the png-img library that leads to heap memory under-allocation and buffer overflow when processing malicious PNG files. This allows attackers to execute arbitrary code or cause denial of service. Any application using vulnerable versions of png-img for PNG image processing is affected.
💻 Affected Systems
- png-img library
📦 What is this software?
Png Img by Png Img Project
⚠️ Risk & Real-World Impact
Worst Case
Remote code execution with the privileges of the application processing the PNG file, potentially leading to complete system compromise.
Likely Case
Application crash (denial of service) or limited code execution within the application's context.
If Mitigated
Application crash with no code execution if memory protections like ASLR are effective.
🎯 Exploit Status
Exploitation requires crafting a malicious PNG file, but public proof-of-concept exists and the vulnerability is in a widely used image processing library.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 3.1.0 and later
Vendor Advisory: https://github.com/gemini-testing/png-img/security/advisories/GHSA-8q8x-8p22-3jqg
Restart Required: No
Instructions:
1. Update png-img dependency to version 3.1.0 or later. 2. For npm: 'npm update png-img'. 3. For direct usage: replace with patched version from GitHub. 4. Rebuild and redeploy affected applications.
🔧 Temporary Workarounds
Input validation and sanitization
allImplement strict validation of PNG files before processing, rejecting malformed or suspicious files.
Memory protection controls
allEnable ASLR, DEP, and other memory protection mechanisms to reduce exploit success.
🧯 If You Can't Patch
- Implement strict network controls to prevent untrusted PNG files from reaching vulnerable systems.
- Use application firewalls or WAFs to block malicious PNG uploads based on file signatures.
🔍 How to Verify
Check if Vulnerable:
Check package.json or dependency files for png-img version below 3.1.0. For npm: 'npm list png-img'.
Check Version:
npm list png-img | grep png-img
Verify Fix Applied:
Confirm png-img version is 3.1.0 or higher. Test with known malicious PNG samples to ensure proper handling.
📡 Detection & Monitoring
Log Indicators:
- Application crashes when processing PNG files
- Memory access violation errors in application logs
- Unusual process spawning after PNG processing
Network Indicators:
- Unexpected outbound connections from applications after PNG uploads
- Large or malformed PNG file uploads
SIEM Query:
source="application.logs" AND ("segmentation fault" OR "access violation" OR "heap corruption") AND "png"
🔗 References
- https://github.com/gemini-testing/png-img
- https://github.com/gemini-testing/png-img/commit/14ac462a32ca4b3b78f56502ac976d5b0222ce3d
- https://github.com/gemini-testing/png-img/compare/v3.0.0...v3.1.0
- https://securitylab.github.com/advisories/GHSL-2020-142-gemini-png-img
- https://github.com/gemini-testing/png-img
- https://github.com/gemini-testing/png-img/commit/14ac462a32ca4b3b78f56502ac976d5b0222ce3d
- https://github.com/gemini-testing/png-img/compare/v3.0.0...v3.1.0
- https://securitylab.github.com/advisories/GHSL-2020-142-gemini-png-img