A Server-Side Request Forgery (SSRF) vulnerability exists in parisneo/lollms versions prior to 2.2.0, specifically in the `/api/files/export-content` endpoint. The `_download_image_to_temp()` function in `backend/routers/files.py` fails to validate user-controlled URLs, allowing attackers to make arbitrary HTTP requests to internal services and cloud metadata endpoints. This vulnerability can lead to internal network access, cloud metadata access, information disclosure, port scanning, and potentially remote code execution.
A critical Server-Side Request Forgery (SSRF) vulnerability in LoLLMs versions before 2.2.0 allows unauthenticated attackers to make arbitrary HTTP requests to internal services and cloud metadata endpoints through the `/api/files/export-content` endpoint. This vulnerability enables unauthorized access to sensitive internal resources, cloud credentials, and potentially facilitates remote code execution. Immediate patching to version 2.2.0 or later is essential for all affected deployments.
IMMEDIATE ACTIONS:
1. Identify all LoLLMs deployments in your environment and document their versions
2. Disable or restrict access to the `/api/files/export-content` endpoint immediately using WAF/firewall rules
3. Review access logs for suspicious requests to this endpoint, particularly those with unusual URL parameters
4. Isolate affected systems from sensitive internal networks if immediate patching is not possible
PATCHING GUIDANCE:
1. Upgrade LoLLMs to version 2.2.0 or later immediately
2. Verify the patch includes URL validation in the `_download_image_to_temp()` function
3. Test the patched version in a staging environment before production deployment
4. Implement automated patching procedures for future updates
COMPENSATING CONTROLS (if patching is delayed):
1. Implement strict network segmentation to isolate LoLLMs instances from internal services
2. Deploy Web Application Firewall (WAF) rules to block requests containing internal IP ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) and cloud metadata endpoints (169.254.169.254, metadata.google.internal, etc.)
3. Implement request filtering to block URLs containing localhost, 127.0.0.1, and internal domain names
4. Enable comprehensive logging and monitoring of all requests to the `/api/files/export-content` endpoint
5. Restrict network egress from LoLLMs instances to only necessary external services
DETECTION RULES:
1. Monitor for POST/GET requests to `/api/files/export-content` with URL parameters containing: internal IP ranges, localhost, cloud metadata endpoints, or unusual port numbers
2. Alert on any HTTP 200 responses from the endpoint followed by unusual outbound connections
3. Track failed connection attempts to internal services (port scanning indicators)
4. Monitor for requests with base64-encoded or URL-encoded internal IP addresses
5. Implement IDS/IPS signatures to detect SSRF exploitation patterns
الإجراءات الفورية:
1. حدد جميع نشرات LoLLMs في بيئتك وقم بتوثيق إصداراتها
2. عطّل أو قيّد الوصول إلى نقطة النهاية `/api/files/export-content` فوراً باستخدام قواعد جدار الحماية/WAF
3. راجع سجلات الوصول للطلبات المريبة إلى هذه النقطة، خاصة تلك التي تحتوي على معاملات URL غير عادية
4. عزل الأنظمة المتأثرة عن الشبكات الداخلية الحساسة إذا لم يكن التحديث الفوري ممكناً
إرشادات التصحيح:
1. قم بترقية LoLLMs إلى الإصدار 2.2.0 أو أحدث فوراً
2. تحقق من أن التصحيح يتضمن التحقق من صحة URL في دالة `_download_image_to_temp()`
3. اختبر الإصدار المصحح في بيئة التجريب قبل نشره في الإنتاج
4. طبّق إجراءات التصحيح الآلي للتحديثات المستقبلية
الضوابط البديلة (إذا تأخر التصحيح):
1. طبّق تقسيم الشبكة الصارم لعزل نشرات LoLLMs عن الخدمات الداخلية
2. نشّر قواعد جدار تطبيقات الويب (WAF) لحجب الطلبات التي تحتوي على نطاقات IP داخلية ونقاط نهاية بيانات السحابة
3. طبّق تصفية الطلبات لحجب عناوين URL التي تحتوي على localhost وعناوين IP الداخلية والأسماء النطاقية الداخلية
4. فعّل السجلات الشاملة ومراقبة جميع الطلبات إلى نقطة النهاية
5. قيّد الخروج من الشبكة من نشرات LoLLMs إلى الخدمات الخارجية الضرورية فقط
قواعد الكشف:
1. راقب طلبات POST/GET إلى `/api/files/export-content` التي تحتوي على معاملات URL تتضمن نطاقات IP داخلية أو localhost أو نقاط نهاية بيانات السحابة
2. أصدر تنبيهات عند استجابات HTTP 200 متبوعة بوصلات خارجية غير عادية
3. تتبع محاولات الاتصال الفاشلة بالخدمات الداخلية
4. راقب الطلبات التي تحتوي على عناوين IP مشفرة بـ base64 أو URL-encoded
5. طبّق توقيعات IDS/IPS للكشف عن أنماط استغلال SSRF