LIBPNG is a reference library for use in applications that read, create, and manipulate PNG (Portable Network Graphics) raster image files. Prior to 1.6.55, an out-of-bounds read vulnerability exists in the png_set_quantize() API function. When the function is called with no histogram and the number of colors in the palette is more than twice the maximum supported by the user's display, certain palettes will cause the function to enter into an infinite loop that reads past the end of an internal heap-allocated buffer. The images that trigger this vulnerability are valid per the PNG specification. This vulnerability is fixed in 1.6.55.
A critical out-of-bounds read vulnerability in libpng versions prior to 1.6.55 allows attackers to trigger infinite loops and memory disclosure through specially crafted PNG images with specific palette configurations. The vulnerability affects the png_set_quantize() API function and has publicly available exploits. Organizations using libpng in image processing, document management, or web applications must prioritize immediate patching to prevent denial-of-service attacks and potential information leakage.
IMMEDIATE ACTIONS:
1. Identify all systems using libpng versions prior to 1.6.55 through software inventory and dependency scanning
2. Disable or restrict access to image upload/processing features if immediate patching is not possible
3. Implement input validation to reject PNG files with palette configurations exceeding twice the display color limit
PATCHING GUIDANCE:
1. Upgrade libpng to version 1.6.55 or later across all affected systems
2. Recompile dependent applications after libpng upgrade
3. Test image processing workflows post-patch to ensure functionality
4. Prioritize production systems and public-facing applications
COMPENSATING CONTROLS (if patching delayed):
1. Implement strict PNG file validation before processing
2. Run image processing in isolated containers with resource limits (memory, CPU timeouts)
3. Monitor for infinite loop conditions and implement watchdog timers
4. Restrict png_set_quantize() API usage to trusted internal processes only
DETECTION RULES:
1. Monitor for PNG files with palette entries > 2x display color maximum
2. Alert on excessive memory consumption during image processing
3. Track libpng version usage: grep -r 'libpng' /usr/lib* | grep -v '1.6.55'
4. Log all png_set_quantize() function calls in applications using libpng
الإجراءات الفورية:
1. تحديد جميع الأنظمة التي تستخدم إصدارات libpng السابقة للإصدار 1.6.55 من خلال مسح المخزون والمكتبات
2. تعطيل أو تقييد الوصول إلى ميزات تحميل/معالجة الصور إذا لم يكن التصحيح الفوري ممكناً
3. تنفيذ التحقق من صحة المدخلات لرفض ملفات PNG بتكوينات لوحة ألوان تتجاوز حد اللون المعروض
إرشادات التصحيح:
1. ترقية libpng إلى الإصدار 1.6.55 أو أحدث عبر جميع الأنظمة المتأثرة
2. إعادة تجميع التطبيقات التابعة بعد ترقية libpng
3. اختبار سير عمل معالجة الصور بعد التصحيح
4. إعطاء الأولوية للأنظمة الإنتاجية والتطبيقات المتاحة للعموم
الضوابط البديلة (إذا تأخر التصحيح):
1. تنفيذ التحقق الصارم من ملفات PNG قبل المعالجة
2. تشغيل معالجة الصور في حاويات معزولة مع حدود الموارد
3. مراقبة ظروف الحلقة اللانهائية وتنفيذ مؤقتات الحراسة
4. تقييد استخدام دالة png_set_quantize() للعمليات الداخلية الموثوقة فقط
قواعد الكشف:
1. مراقبة ملفات PNG بإدخالات لوحة ألوان > 2x حد اللون المعروض
2. تنبيه على استهلاك الذاكرة المفرط أثناء معالجة الصور
3. تتبع استخدام إصدار libpng
4. تسجيل جميع استدعاءات دالة png_set_quantize()