Apache HTTP Server Path Traversal Vulnerability — Apache HTTP Server contains a path traversal vulnerability that allows an attacker to perform remote code execution if files outside directories configured by Alias-like directives are not under default require all denied or if CGI scripts are enabled. This CVE ID resolves an incomplete patch for CVE-2021-41773.
CVE-2021-42013 is a critical path traversal vulnerability in Apache HTTP Server (CVSS 9.0) that enables remote code execution through incomplete patching of CVE-2021-41773. Attackers can bypass directory restrictions and execute arbitrary code if Alias directives lack proper access controls or CGI is enabled. This vulnerability poses an immediate threat to Saudi organizations running vulnerable Apache versions, particularly government and financial institutions relying on web-based services.
IMMEDIATE ACTIONS:
1. Identify all Apache HTTP Server instances in your environment (versions 2.4.49-2.4.50 are most vulnerable)
2. Disable CGI modules (mod_cgi, mod_cgid) if not required: a2dismod cgi cgid
3. Implement strict access controls: ensure all Alias directives have explicit 'Require all denied' directives
4. Apply emergency firewall rules to restrict access to web server ports (80/443) to trusted sources only
PATCHING GUIDANCE:
1. Upgrade Apache HTTP Server to version 2.4.51 or later immediately
2. For RHEL/CentOS: yum update httpd
3. For Debian/Ubuntu: apt-get update && apt-get install apache2
4. For Windows: download latest MSI from apache.org and perform in-place upgrade
5. Restart Apache service after patching: systemctl restart apache2
COMPENSATING CONTROLS (if immediate patching not possible):
1. Implement WAF rules blocking path traversal patterns (../, ..\, %2e%2e)
2. Use ModSecurity with OWASP CRS ruleset
3. Restrict file permissions: ensure web root directories have minimal permissions
4. Disable directory listing: Options -Indexes
5. Monitor access logs for suspicious patterns: grep -E '\.\./' /var/log/apache2/access.log
DETECTION RULES:
1. Monitor for requests containing: ../, ..\, %2e%2e, %252e, encoded traversal sequences
2. Alert on CGI script execution from unexpected paths
3. Track failed 'Require all denied' access attempts
4. Monitor process execution from web server user context (www-data, apache, httpd)
الإجراءات الفورية:
1. تحديد جميع مثيلات خادم Apache HTTP في بيئتك (الإصدارات 2.4.49-2.4.50 الأكثر عرضة)
2. تعطيل وحدات CGI (mod_cgi, mod_cgid) إذا لم تكن مطلوبة: a2dismod cgi cgid
3. تطبيق ضوابط وصول صارمة: تأكد من أن جميع توجيهات Alias لديها توجيهات 'Require all denied' صريحة
4. تطبيق قواعد جدار الحماية الطارئة لتقييد الوصول إلى منافذ خادم الويب (80/443) للمصادر الموثوقة فقط
إرشادات التصحيح:
1. ترقية خادم Apache HTTP إلى الإصدار 2.4.51 أو أحدث على الفور
2. لـ RHEL/CentOS: yum update httpd
3. لـ Debian/Ubuntu: apt-get update && apt-get install apache2
4. لـ Windows: قم بتنزيل أحدث MSI من apache.org وإجراء ترقية في المكان
5. إعادة تشغيل خدمة Apache بعد التصحيح: systemctl restart apache2
الضوابط البديلة (إذا لم يكن التصحيح الفوري ممكناً):
1. تطبيق قواعد WAF لحجب أنماط تجاوز المسارات (../, ..\, %2e%2e)
2. استخدام ModSecurity مع مجموعة قواعد OWASP CRS
3. تقييد أذونات الملفات: تأكد من أن دلائل جذر الويب لديها أذونات دنيا
4. تعطيل قائمة الدلائل: Options -Indexes
5. مراقبة سجلات الوصول للأنماط المريبة: grep -E '\.\./' /var/log/apache2/access.log
قواعد الكشف:
1. مراقبة الطلبات التي تحتوي على: ../, ..\, %2e%2e, %252e, تسلسلات تجاوز مشفرة
2. تنبيه عند تنفيذ سكريبت CGI من مسارات غير متوقعة
3. تتبع محاولات الوصول الفاشلة 'Require all denied'
4. مراقبة تنفيذ العمليات من سياق مستخدم خادم الويب (www-data, apache, httpd)