Apache Struts Remote Code Execution Vulnerability — Apache Struts Jakarta Multipart parser allows for malicious file upload using the Content-Type value, leading to remote code execution.
CVE-2017-5638 is a critical remote code execution vulnerability in the Apache Struts Jakarta Multipart parser that allows attackers to execute arbitrary commands on the server by crafting a malicious Content-Type header in HTTP requests. This vulnerability has a CVSS score of 9.0 and has been actively exploited in the wild, most notably in the 2017 Equifax breach that compromised 147 million records. Public exploits are widely available, making this an extremely high-risk vulnerability for any organization running unpatched Apache Struts applications. Immediate patching is essential as automated exploitation tools and scripts are readily accessible to threat actors.
IMMEDIATE ACTIONS:
1. Identify all Apache Struts instances in your environment, particularly versions 2.3.x before 2.3.32 and 2.5.x before 2.5.10.1
2. Apply the official patch immediately — upgrade to Apache Struts 2.3.32 or 2.5.10.1 or later
3. If immediate patching is not possible, implement the following compensating controls:
- Deploy WAF rules to block requests with malicious Content-Type headers containing OGNL expressions
- Filter Content-Type headers at the reverse proxy/load balancer level
- Switch to a different Multipart parser implementation (e.g., Jason Pell Multipart plugin)
DETECTION RULES:
4. Monitor web server logs for unusual Content-Type headers containing '#cmd=' or 'multipart/form-data' with OGNL expressions
5. Deploy IDS/IPS signatures for Struts2 OGNL injection patterns (Snort SID: 41818, 41819)
6. Monitor for unexpected outbound connections from web application servers
7. Check for indicators of compromise: unexpected processes, new user accounts, modified files
LONG-TERM:
8. Implement a web application firewall (WAF) with virtual patching capabilities
9. Conduct a full inventory of all Java-based web applications and their framework versions
10. Establish a vulnerability management program with SLA-based patching timelines
الإجراءات الفورية:
1. تحديد جميع مثيلات Apache Struts في بيئتكم، خاصة الإصدارات 2.3.x قبل 2.3.32 و 2.5.x قبل 2.5.10.1
2. تطبيق التصحيح الرسمي فوراً — الترقية إلى Apache Struts 2.3.32 أو 2.5.10.1 أو أحدث
3. في حال عدم إمكانية التصحيح الفوري، تطبيق الضوابط التعويضية التالية:
- نشر قواعد جدار حماية تطبيقات الويب لحظر الطلبات ذات رؤوس Content-Type الضارة المحتوية على تعبيرات OGNL
- تصفية رؤوس Content-Type على مستوى الوكيل العكسي/موازن الأحمال
- التبديل إلى تنفيذ محلل Multipart مختلف
قواعد الكشف:
4. مراقبة سجلات خادم الويب بحثاً عن رؤوس Content-Type غير عادية تحتوي على '#cmd=' أو تعبيرات OGNL
5. نشر توقيعات IDS/IPS لأنماط حقن OGNL في Struts2
6. مراقبة الاتصالات الصادرة غير المتوقعة من خوادم تطبيقات الويب
7. التحقق من مؤشرات الاختراق: العمليات غير المتوقعة، الحسابات الجديدة، الملفات المعدلة
على المدى الطويل:
8. تنفيذ جدار حماية تطبيقات الويب مع إمكانيات التصحيح الافتراضي
9. إجراء جرد شامل لجميع تطبيقات الويب المبنية على Java وإصدارات أطرها
10. إنشاء برنامج إدارة الثغرات مع جداول زمنية للتصحيح مبنية على اتفاقيات مستوى الخدمة