Ollama 0.11.5-rc0 through current version 0.13.5 contain a null pointer dereference vulnerability in the multi-modal model image processing functionality. When processing base64-encoded image data via the /api/chat endpoint, the application fails to validate that the decoded data represents valid media before passing it to the mtmd_helper_bitmap_init_from_buf function. This function can return NULL for malformed input, but the code does not check this return value before dereferencing the pointer in subsequent operations. A remote attacker can exploit this by sending specially crafted base64 image data that decodes to invalid media, causing a segmentation fault and crashing the runner process. This results in a denial of service condition where the model becomes unavailable to all users until the service is restarted.
Ollama versions 0.11.5-rc0 through 0.13.5 contain a null pointer dereference vulnerability in multi-modal image processing that allows remote attackers to crash the service via malformed base64-encoded image data. The vulnerability affects the /api/chat endpoint and results in denial of service, making AI models unavailable until service restart. With an available exploit and active patch, immediate patching is critical for organizations deploying Ollama in production environments.
IMMEDIATE ACTIONS:
1. Identify all Ollama deployments in your environment using asset discovery tools and network scanning
2. Check version numbers: if running 0.11.5-rc0 through 0.13.5, prioritize for patching
3. Implement network-level access controls to restrict /api/chat endpoint to trusted sources only
4. Enable API authentication if not already configured
PATCHING GUIDANCE:
1. Upgrade to Ollama version 0.13.6 or later (patch available)
2. Test patches in non-production environment first
3. Plan maintenance window for production upgrades to minimize service disruption
4. Verify patch installation by checking version output: ollama --version
COMPENSATING CONTROLS (if immediate patching not possible):
1. Deploy WAF/API gateway rules to validate base64 image input format before forwarding to Ollama
2. Implement request size limits on /api/chat endpoint (malformed images typically have unusual sizes)
3. Use reverse proxy to rate-limit requests to /api/chat from single sources
4. Monitor process crashes and implement auto-restart mechanism with alerting
DETECTION RULES:
1. Monitor for segmentation faults in Ollama runner process logs
2. Alert on repeated /api/chat requests with base64 payloads exceeding normal image sizes
3. Track service restarts and correlate with API request patterns
4. Log all /api/chat requests with image data for forensic analysis
الإجراءات الفورية:
1. تحديد جميع نشرات Ollama في بيئتك باستخدام أدوات اكتشاف الأصول والمسح الشبكي
2. التحقق من أرقام الإصدارات: إذا كنت تقوم بتشغيل 0.11.5-rc0 حتى 0.13.5، فأعطها الأولوية للتصحيح
3. تطبيق عناصر التحكم في الوصول على مستوى الشبكة لتقييد نقطة نهاية /api/chat للمصادر الموثوقة فقط
4. تفعيل مصادقة API إن لم تكن مكونة بالفعل
إرشادات التصحيح:
1. الترقية إلى إصدار Ollama 0.13.6 أو أحدث (التصحيح متاح)
2. اختبار التصحيحات في بيئة غير الإنتاج أولاً
3. التخطيط لنافذة صيانة لترقيات الإنتاج لتقليل انقطاع الخدمة
4. التحقق من تثبيت التصحيح بفحص إخراج الإصدار: ollama --version
عناصر التحكم البديلة (إذا لم يكن التصحيح الفوري ممكناً):
1. نشر قواعد WAF/بوابة API للتحقق من صيغة إدخال صور base64 قبل إعادة التوجيه إلى Ollama
2. تطبيق حدود حجم الطلب على نقطة نهاية /api/chat (الصور المعيبة عادة ما يكون لها أحجام غير عادية)
3. استخدام وكيل عكسي لتحديد معدل الطلبات إلى /api/chat من مصادر واحدة
4. مراقبة أعطال العملية وتطبيق آلية إعادة التشغيل التلقائي مع التنبيهات
قواعد الكشف:
1. مراقبة أخطاء التجزئة في سجلات عملية تشغيل Ollama
2. التنبيه على طلبات /api/chat المتكررة مع حمولات base64 تتجاوز أحجام الصور العادية
3. تتبع إعادة تشغيل الخدمة والربط مع أنماط طلبات API
4. تسجيل جميع طلبات /api/chat مع بيانات الصور للتحليل الجنائي