Endian Firewall version 3.3.25 and prior allow authenticated users to execute arbitrary OS commands via the DATE parameter to /cgi-bin/logs_smtp.cgi. The DATE parameter value is used to construct a file path that is passed to a Perl open() call, which allows command injection due to an incomplete regular expression validation.
Endian Firewall versions 3.3.25 and prior contain a critical command injection vulnerability in the SMTP logs module that allows authenticated users to execute arbitrary OS commands. The vulnerability exploits incomplete input validation in the DATE parameter passed to /cgi-bin/logs_smtp.cgi, enabling attackers with valid credentials to gain full system compromise. This poses significant risk to Saudi organizations using Endian Firewall as their primary security gateway, particularly in banking and government sectors where firewall integrity is critical.
IMMEDIATE ACTIONS:
1. Verify Endian Firewall version in use — check /etc/endian-release or admin console
2. Restrict administrative access to /cgi-bin/logs_smtp.cgi via firewall rules or web server ACLs
3. Implement network segmentation to limit access to firewall management interfaces
4. Review authentication logs for suspicious DATE parameter usage patterns
5. Disable SMTP logging functionality if not operationally required
PATCHING GUIDANCE:
1. Contact Endian support immediately for security patch availability timeline
2. If patch unavailable, plan migration to alternative firewall solutions (Palo Alto, Fortinet, Cisco ASA)
3. Implement temporary compensating controls: disable web-based log access, use SSH-only administration
COMPENSATING CONTROLS (if patch unavailable):
1. Deploy WAF rules to block requests containing shell metacharacters in DATE parameter (;|&$()\`)
2. Implement strict input validation: DATE parameter must match YYYY-MM-DD format only
3. Run Endian Firewall in restricted container/VM with minimal OS privileges
4. Enable command auditing on firewall OS to detect unauthorized command execution
5. Implement real-time file integrity monitoring on /cgi-bin/ directory
DETECTION RULES:
1. Monitor HTTP POST requests to /cgi-bin/logs_smtp.cgi with DATE parameters containing: backticks, $(), semicolons, pipes, ampersands, or backslashes
2. Alert on any process spawning from Perl interpreter with suspicious command patterns
3. Monitor /var/log/auth.log for root command execution from www-data or firewall web service user
4. Detect file creation/modification in /tmp or /var/tmp from firewall processes
5. IDS signature: Alert on HTTP requests matching regex: logs_smtp\.cgi.*DATE=.*[;|&$()\`]
الإجراءات الفورية:
1. تحقق من إصدار جدار حماية Endian قيد الاستخدام — تحقق من /etc/endian-release أو وحدة التحكم الإدارية
2. قيد الوصول الإداري إلى /cgi-bin/logs_smtp.cgi عبر قواعد جدار الحماية أو قوائم التحكم في الوصول لخادم الويب
3. تنفيذ تقسيم الشبكة لتحديد الوصول إلى واجهات إدارة جدار الحماية
4. راجع سجلات المصادقة للأنماط المريبة في استخدام معامل DATE
5. عطّل وظيفة تسجيل SMTP إذا لم تكن مطلوبة تشغيلياً
إرشادات التصحيح:
1. اتصل بدعم Endian فوراً للحصول على الجدول الزمني لتوفر تصحيح الأمان
2. إذا لم يكن التصحيح متاحاً، خطط للهجرة إلى حلول جدار حماية بديلة (Palo Alto, Fortinet, Cisco ASA)
3. تنفيذ الضوابط التعويضية: تعطيل الوصول إلى السجلات عبر الويب، استخدام الإدارة عبر SSH فقط
الضوابط التعويضية (إذا لم يكن التصحيح متاحاً):
1. نشر قواعد WAF لحجب الطلبات التي تحتوي على أحرف shell في معامل DATE (;|&$()\`)
2. تنفيذ التحقق الصارم من المدخلات: يجب أن يطابق معامل DATE تنسيق YYYY-MM-DD فقط
3. تشغيل جدار حماية Endian في حاوية/VM مقيدة بامتيازات نظام تشغيل دنيا
4. تفعيل تدقيق الأوامر على نظام تشغيل جدار الحماية للكشف عن تنفيذ الأوامر غير المصرح به
5. تنفيذ المراقبة الفورية لسلامة الملفات في دليل /cgi-bin/
قواعد الكشف:
1. مراقبة طلبات HTTP POST إلى /cgi-bin/logs_smtp.cgi مع معاملات DATE تحتوي على: علامات اقتباس عكسية، $()، فواصل منقوطة، أنابيب، علامات العطف، أو شرطات مائلة للخلف
2. تنبيه على أي عملية تنبثق من مترجم Perl مع أنماط أوامر مريبة
3. مراقبة /var/log/auth.log لتنفيذ أوامر root من مستخدم www-data أو خدمة ويب جدار الحماية
4. الكشف عن إنشاء/تعديل الملفات في /tmp أو /var/tmp من عمليات جدار الحماية
5. توقيع IDS: تنبيه على طلبات HTTP المطابقة للتعبير العادي: logs_smtp\.cgi.*DATE=.*[;|&$()\`]