ModSecurity is an open source, cross platform web application firewall (WAF) engine for Apache, IIS and Nginx. Libmodsecurity is one component of the ModSecurity v3 project. A segmentation fault occurs when a rule using the t:hexDecode transformation inspects a query string parameter containing a single character. An attacker can exploit this to crash worker processes, causing a denial of service. Service resumes once the attack stops as worker processes recover from the segfault. All versions before 3.0.15 of libModSecurity3 are affected. This has been patched in version 3.0.15.
ModSecurity libmodsecurity3 versions before 3.0.15 contain a segmentation fault vulnerability in the hexDecode transformation when processing single-character query string parameters. This allows remote attackers to crash WAF worker processes, causing denial of service. The vulnerability is easily exploitable and affects all organizations using ModSecurity as their primary WAF, with immediate patching required to prevent service disruption.
IMMEDIATE ACTIONS:
1. Identify all ModSecurity/libmodsecurity3 deployments in your infrastructure
2. Check current version: modsec -v or review installed package versions
3. Implement rate limiting on query string parameters to reduce attack surface
4. Monitor WAF worker process crashes and restart failures
PATCHING:
1. Upgrade libmodsecurity3 to version 3.0.15 or later immediately
2. For Apache: Update ModSecurity module to compatible version
3. For Nginx: Rebuild with updated libmodsecurity3 library
4. For IIS: Update ModSecurity IIS connector to latest version
5. Test patches in staging environment before production deployment
COMPENSATING CONTROLS (if immediate patching delayed):
1. Disable hexDecode transformation in rules temporarily if not critical
2. Implement input validation to reject single-character query parameters
3. Deploy WAF worker process monitoring with automatic restart on crash
4. Add IDS/IPS rules to detect hexDecode exploitation attempts
5. Implement request filtering to block suspicious query string patterns
DETECTION:
1. Monitor WAF logs for segmentation faults or worker process crashes
2. Alert on repeated 502/503 responses from WAF
3. Track query string parameters with single characters in access logs
4. Monitor system logs for ModSecurity worker process termination signals
5. Implement SIEM correlation for WAF availability metrics
الإجراءات الفورية:
1. تحديد جميع نشرات ModSecurity/libmodsecurity3 في البنية التحتية الخاصة بك
2. التحقق من الإصدار الحالي: modsec -v أو مراجعة إصدارات الحزم المثبتة
3. تنفيذ تحديد معدل على معاملات سلسلة الاستعلام لتقليل سطح الهجوم
4. مراقبة أعطال عمليات عامل جدار الحماية وفشل إعادة التشغيل
التصحيح:
1. ترقية libmodsecurity3 إلى الإصدار 3.0.15 أو أحدث فورًا
2. لـ Apache: تحديث وحدة ModSecurity إلى إصدار متوافق
3. لـ Nginx: إعادة بناء مع مكتبة libmodsecurity3 المحدثة
4. لـ IIS: تحديث موصل ModSecurity IIS إلى أحدث إصدار
5. اختبار التصحيحات في بيئة التجميع قبل نشر الإنتاج
الضوابط البديلة (إذا تأخر التصحيح الفوري):
1. تعطيل تحويل hexDecode في القواعد مؤقتًا إذا لم يكن حرجًا
2. تنفيذ التحقق من صحة الإدخال لرفض معاملات سلسلة الاستعلام ذات الحرف الواحد
3. نشر مراقبة عملية عامل جدار الحماية مع إعادة التشغيل التلقائي عند الانهيار
4. إضافة قواعد IDS/IPS للكشف عن محاولات استغلال hexDecode
5. تنفيذ تصفية الطلبات لحظر أنماط سلسلة الاستعلام المريبة
الكشف:
1. مراقبة سجلات جدار الحماية للأعطال أو أعطال عمليات العامل
2. التنبيه على استجابات 502/503 المتكررة من جدار الحماية
3. تتبع معاملات سلسلة الاستعلام ذات الأحرف الفردية في سجلات الوصول
4. مراقبة سجلات النظام لإشارات إنهاء عملية عامل ModSecurity
5. تنفيذ ارتباط SIEM لمقاييس توفر جدار الحماية