LiteLLM is a proxy server (AI Gateway) to call LLM APIs in OpenAI (or native) format. From version 1.80.5 to before version 1.83.7, the POST /prompts/test endpoint accepted user-supplied prompt templates and rendered them without sandboxing. A crafted template could run arbitrary code inside the LiteLLM Proxy process. The endpoint only checks that the caller presents a valid proxy API key, so any authenticated user could reach it. Depending on how the proxy is deployed, this could expose secrets in the process environment (such as provider API keys or database credentials) and allow commands to be run on the host. This issue has been patched in version 1.83.7.
LiteLLM versions 1.80.5 to 1.83.6 contain a critical code injection vulnerability in the POST /prompts/test endpoint that allows authenticated users to execute arbitrary code within the proxy process. The vulnerability stems from unsandboxed rendering of user-supplied prompt templates, potentially exposing sensitive credentials and enabling command execution on the host system. This poses significant risk to organizations using LiteLLM as an AI Gateway, particularly those managing multiple LLM provider integrations.
IMMEDIATE ACTIONS:
1. Identify all LiteLLM deployments in your environment and verify versions (1.80.5 to 1.83.6 are vulnerable)
2. Restrict network access to LiteLLM proxy endpoints using firewall rules and network segmentation
3. Review API key audit logs for unauthorized /prompts/test endpoint access
4. Rotate all provider API keys, database credentials, and secrets that may have been exposed
PATCHING:
1. Upgrade LiteLLM to version 1.83.7 or later immediately
2. Test the patched version in a staging environment before production deployment
3. Implement automated patching procedures for future LiteLLM updates
COMPENSATING CONTROLS (if immediate patching is not possible):
1. Disable the /prompts/test endpoint at the reverse proxy/load balancer level
2. Implement strict API key validation and rate limiting on all LiteLLM endpoints
3. Run LiteLLM in a containerized environment with minimal privileges and restricted environment variables
4. Monitor process execution and environment variable access using EDR/XDR solutions
DETECTION:
1. Monitor for POST requests to /prompts/test endpoint with suspicious template payloads
2. Alert on any child process spawning from LiteLLM process (python, bash, cmd.exe)
3. Monitor environment variable access and credential exposure in logs
4. Implement SIEM rules to detect template injection patterns (e.g., Jinja2, Mako syntax in prompts)
الإجراءات الفورية:
1. حدد جميع نشرات LiteLLM في بيئتك والتحقق من الإصدارات (الإصدارات 1.80.5 إلى 1.83.6 معرضة للخطر)
2. قيد الوصول إلى نقاط نهاية وكيل LiteLLM باستخدام قواعد جدار الحماية وتقسيم الشبكة
3. راجع سجلات تدقيق مفاتيح API للوصول غير المصرح به إلى نقطة نهاية /prompts/test
4. قم بتدوير جميع مفاتيح موفري الخدمات وبيانات اعتماد قاعدة البيانات والأسرار التي قد تكون قد تعرضت
التصحيح:
1. قم بترقية LiteLLM إلى الإصدار 1.83.7 أو أحدث على الفور
2. اختبر الإصدار المصحح في بيئة التجميع قبل نشر الإنتاج
3. تنفيذ إجراءات التصحيح الآلي لتحديثات LiteLLM المستقبلية
الضوابط البديلة (إذا لم يكن التصحيح الفوري ممكناً):
1. تعطيل نقطة نهاية /prompts/test على مستوى الوكيل العكسي/موازن التحميل
2. تنفيذ التحقق الصارم من مفاتيح API وتحديد معدل على جميع نقاط نهاية LiteLLM
3. تشغيل LiteLLM في بيئة حاوية بامتيازات محدودة ومتغيرات بيئة مقيدة
4. مراقبة تنفيذ العملية والوصول إلى متغيرات البيئة باستخدام حلول EDR/XDR
الكشف:
1. مراقبة طلبات POST إلى نقطة نهاية /prompts/test بحمولات قالب مريبة
2. تنبيه على أي عملية فرعية تنبثق من عملية LiteLLM (python, bash, cmd.exe)
3. مراقبة الوصول إلى متغيرات البيئة وتعريض بيانات الاعتماد في السجلات
4. تنفيذ قواعد SIEM للكشف عن أنماط حقن القالب (مثل بناء جملة Jinja2 و Mako في المطالبات)