Pillow is a Python imaging library. From 10.3.0 to before 12.1.1, n out-of-bounds write may be triggered when loading a specially crafted PSD image. This vulnerability is fixed in 12.1.1.
CVE-2026-25990 is a high-severity out-of-bounds write vulnerability in Pillow (Python imaging library) versions 10.3.0 through 12.1.0 that can be triggered by specially crafted PSD image files. This vulnerability could allow attackers to execute arbitrary code or cause denial of service through malicious image processing. Immediate patching to version 12.1.1 or later is critical for organizations using Pillow in production environments.
IMMEDIATE ACTIONS:
1. Identify all systems running Pillow versions 10.3.0 through 12.1.0 using: pip list | grep -i pillow
2. Implement input validation to reject PSD file uploads if not essential to business operations
3. Isolate affected systems from direct internet access if immediate patching is not possible
PATCHING GUIDANCE:
1. Upgrade Pillow to version 12.1.1 or later: pip install --upgrade Pillow>=12.1.1
2. For containerized environments, rebuild images with updated Pillow version
3. Restart all applications using Pillow after patching
4. Verify patch installation: python -c "import PIL; print(PIL.__version__)"
COMPENSATING CONTROLS (if patching delayed):
1. Disable PSD file processing capabilities if not business-critical
2. Implement strict file type validation at upload points (whitelist only required formats)
3. Process image files in sandboxed environments with restricted privileges
4. Use Web Application Firewall (WAF) rules to block suspicious PSD file uploads
5. Monitor file upload endpoints for anomalous activity
DETECTION RULES:
1. Monitor for Python process crashes or segmentation faults when processing images
2. Alert on unexpected memory access patterns in Pillow operations
3. Log all PSD file upload attempts and processing activities
4. Monitor for unusual process spawning from Python/Pillow processes
الإجراءات الفورية:
1. تحديد جميع الأنظمة التي تقوم بتشغيل إصدارات Pillow من 10.3.0 إلى 12.1.0 باستخدام: pip list | grep -i pillow
2. تطبيق التحقق من صحة المدخلات لرفض تحميلات ملفات PSD إذا لم تكن ضرورية للعمليات التجارية
3. عزل الأنظمة المتأثرة عن الوصول المباشر للإنترنت إذا لم يكن التحديث الفوري ممكناً
إرشادات التصحيح:
1. ترقية Pillow إلى الإصدار 12.1.1 أو أحدث: pip install --upgrade Pillow>=12.1.1
2. للبيئات المحتوية، إعادة بناء الصور باستخدام إصدار Pillow المحدث
3. إعادة تشغيل جميع التطبيقات التي تستخدم Pillow بعد التصحيح
4. التحقق من تثبيت التصحيح: python -c "import PIL; print(PIL.__version__)"
الضوابط البديلة (إذا تأخر التصحيح):
1. تعطيل قدرات معالجة ملفات PSD إذا لم تكن حرجة للعمل
2. تطبيق التحقق الصارم من نوع الملف عند نقاط التحميل (قائمة بيضاء بالصيغ المطلوبة فقط)
3. معالجة ملفات الصور في بيئات معزولة بامتيازات محدودة
4. استخدام قواعد جدار حماية تطبيقات الويب (WAF) لحظر تحميلات ملفات PSD المريبة
5. مراقبة نقاط تحميل الملفات للكشف عن النشاط الشاذ
قواعد الكشف:
1. مراقبة أعطال عمليات Python أو أخطاء المقاطع عند معالجة الصور
2. التنبيه على أنماط الوصول إلى الذاكرة غير المتوقعة في عمليات Pillow
3. تسجيل جميع محاولات تحميل ملفات PSD والأنشطة المعالجة
4. مراقبة توليد العمليات غير المعتادة من عمليات Python/Pillow