libheif is a HEIF and AVIF file format decoder and encoder. In versions 1.21.2 and prior, a crafted HEIF sequence file where the saiz box declares more samples than actually exist in the track's chunk table causes a heap-buffer-overflow (out-of-bounds read) in the SampleAuxInfoReader constructor. The SampleAuxInfoReader constructor iterates over saiz->get_num_samples() samples but doesn't validate that this count is consistent with the number of chunks in the chunks vector. When saiz declares more samples than the chunks cover, the loop increments current_chunk past chunks.size(), causing an out-of-bounds read on the chunks vector. The vulnerability is triggered during file parsing (heif_context_read_from_file) without any additional user interaction. Any application using libheif to open untrusted HEIF files is affected. This issue has been fixed in version 1.22.0.
CVE-2026-41071 is a critical heap buffer overflow vulnerability in libheif versions 1.21.2 and prior, triggered by maliciously crafted HEIF/AVIF files with inconsistent sample counts. The vulnerability allows out-of-bounds memory reads during file parsing without user interaction, potentially enabling denial of service or information disclosure. With exploit availability confirmed and widespread use of libheif in media processing applications across Saudi organizations, immediate patching to version 1.22.0 is essential.
IMMEDIATE ACTIONS:
1. Identify all systems and applications using libheif versions 1.21.2 or earlier through software inventory and dependency scanning
2. Implement file upload restrictions: block HEIF/AVIF file uploads from untrusted sources until patching is complete
3. Isolate affected systems from processing untrusted media files
PATCHING GUIDANCE:
1. Upgrade libheif to version 1.22.0 or later immediately
2. For applications with embedded libheif, contact vendors for patched versions
3. Test patches in non-production environments before deployment
4. Prioritize patching for systems processing external/user-supplied media
COMPENSATING CONTROLS (if patching delayed):
1. Implement strict input validation: validate HEIF file structure before processing
2. Run libheif processing in sandboxed/containerized environments with resource limits
3. Disable HEIF/AVIF support in applications where not critical
4. Implement network segmentation to limit lateral movement from compromised processes
5. Monitor for abnormal memory access patterns and application crashes
DETECTION RULES:
1. Monitor for application crashes when processing HEIF/AVIF files
2. Alert on unexpected memory access violations in libheif processes
3. Track file uploads with HEIF/AVIF extensions (.heif, .heic, .avif)
4. Monitor system calls for out-of-bounds memory access attempts
5. Log all libheif library version information in security events
الإجراءات الفورية:
1. تحديد جميع الأنظمة والتطبيقات التي تستخدم إصدارات libheif 1.21.2 أو أقدم من خلال مسح المخزون والاعتماديات
2. تنفيذ قيود تحميل الملفات: حظر تحميل ملفات HEIF/AVIF من مصادر غير موثوقة حتى يتم التصحيح
3. عزل الأنظمة المتأثرة عن معالجة ملفات الوسائط غير الموثوقة
إرشادات التصحيح:
1. ترقية libheif إلى الإصدار 1.22.0 أو أحدث فوراً
2. للتطبيقات التي تحتوي على libheif مدمج، اتصل بالبائعين للحصول على إصدارات مصححة
3. اختبر التصحيحات في بيئات غير الإنتاج قبل النشر
4. أولويات التصحيح للأنظمة التي تعالج الوسائط الخارجية/المزودة من قبل المستخدم
الضوابط البديلة (إذا تأخر التصحيح):
1. تنفيذ التحقق الصارم من المدخلات: التحقق من بنية ملف HEIF قبل المعالجة
2. تشغيل معالجة libheif في بيئات معزولة/حاوية مع حدود الموارد
3. تعطيل دعم HEIF/AVIF في التطبيقات حيث لا يكون حرجاً
4. تنفيذ تقسيم الشبكة لتحديد الحركة الجانبية من العمليات المخترقة
5. مراقبة أنماط الوصول إلى الذاكرة غير الطبيعية وأعطال التطبيقات
قواعد الكشف:
1. مراقبة أعطال التطبيقات عند معالجة ملفات HEIF/AVIF
2. التنبيه على انتهاكات الوصول إلى الذاكرة غير المتوقعة في عمليات libheif
3. تتبع تحميلات الملفات بامتدادات HEIF/AVIF (.heif, .heic, .avif)
4. مراقبة استدعاءات النظام لمحاولات الوصول إلى الذاكرة خارج الحدود
5. تسجيل جميع معلومات إصدار مكتبة libheif في أحداث الأمان