Drupal Core Remote Code Execution Vulnerability — In Drupal Core, some field types do not properly sanitize data from non-form sources. This can lead to arbitrary PHP code execution in some cases.
CVE-2019-6340 is a critical remote code execution vulnerability in Drupal Core (CVSS 9.0) where certain field types fail to properly sanitize data from non-form sources such as REST API endpoints. An unauthenticated attacker can exploit this flaw to execute arbitrary PHP code on the server, leading to full system compromise. A public exploit is available, making this vulnerability actively weaponizable with minimal technical skill. Organizations running unpatched Drupal installations face immediate risk of complete server takeover, data exfiltration, and lateral movement.
IMMEDIATE ACTIONS:
1. Identify all Drupal installations in your environment using asset inventory tools.
2. Disable REST API module and other web services modules (RESTful Web Services, JSON:API, Services) immediately if not required.
3. Implement WAF rules to block malicious serialized PHP payloads targeting REST endpoints.
PATCHING GUIDANCE:
4. Upgrade to Drupal 8.6.10 or 8.5.11 immediately (patches released February 20, 2019).
5. For Drupal 7, apply the corresponding security patch if REST services are enabled.
6. Verify patch integrity using official Drupal.org checksums.
COMPENSATING CONTROLS (if patching is delayed):
7. Restrict access to /node, /user, /comment REST endpoints via .htaccess or web server ACLs.
8. Block unauthenticated access to REST API endpoints at the network perimeter.
9. Deploy PHP disable_functions in php.ini to restrict dangerous functions (exec, shell_exec, system, passthru).
10. Enable ModSecurity with OWASP CRS ruleset targeting PHP injection patterns.
DETECTION RULES:
11. Monitor web server logs for unusual POST/PATCH requests to /node/, /user/, /comment/ endpoints with serialized PHP content.
12. Create SIEM alerts for PHP execution anomalies and unexpected outbound connections from web servers.
13. Deploy file integrity monitoring on Drupal core files to detect webshell placement.
14. Search for indicators: requests containing 'O:' serialization patterns or 'php://' wrappers in REST payloads.
الإجراءات الفورية:
1. تحديد جميع تثبيتات Drupal في بيئتك باستخدام أدوات جرد الأصول.
2. تعطيل وحدة REST API وغيرها من وحدات خدمات الويب (RESTful Web Services، JSON:API، Services) فوراً إذا لم تكن مطلوبة.
3. تطبيق قواعد WAF لحجب حمولات PHP المتسلسلة الضارة التي تستهدف نقاط نهاية REST.
إرشادات التصحيح:
4. الترقية إلى Drupal 8.6.10 أو 8.5.11 فوراً (صدرت التصحيحات في 20 فبراير 2019).
5. بالنسبة لـ Drupal 7، تطبيق تصحيح الأمان المقابل إذا كانت خدمات REST مفعّلة.
6. التحقق من سلامة التصحيح باستخدام المجاميع الاختبارية الرسمية من Drupal.org.
ضوابط التعويض (في حالة تأخر التصحيح):
7. تقييد الوصول إلى نقاط نهاية /node و/user و/comment عبر .htaccess أو قوائم التحكم في الوصول لخادم الويب.
8. حجب الوصول غير المصادق عليه إلى نقاط نهاية REST API على محيط الشبكة.
9. تعطيل الدوال الخطرة في php.ini مثل exec وshell_exec وsystem وpassthru.
10. تفعيل ModSecurity مع مجموعة قواعد OWASP CRS لاستهداف أنماط حقن PHP.
قواعد الكشف:
11. مراقبة سجلات خادم الويب للطلبات غير المعتادة من نوع POST/PATCH إلى نقاط النهاية مع محتوى PHP متسلسل.
12. إنشاء تنبيهات SIEM لشذوذات تنفيذ PHP والاتصالات الصادرة غير المتوقعة من خوادم الويب.
13. نشر مراقبة سلامة الملفات على ملفات Drupal الأساسية للكشف عن زرع الـ webshell.
14. البحث عن المؤشرات: الطلبات التي تحتوي على أنماط تسلسل 'O:' أو أغلفة 'php://' في حمولات REST.