The Drag and Drop Multiple File Upload for Contact Form 7 plugin for WordPress is vulnerable to Path Traversal leading to Arbitrary File Read in versions up to and including 1.3.9.6. This is due to the plugin using client-supplied mfile[] POST values as the source of truth for email attachment selection without performing any server-side upload provenance check, path canonicalization, or directory containment boundary enforcement. In dnd_wpcf7_posted_data(), each user-submitted filename is directly appended to the plugin's upload URL without sanitization. In dnd_cf7_mail_components(), the URL is converted back to a filesystem path using str_replace() and only file_exists() is used as the acceptance check before attaching the file to the outgoing CF7 email. This makes it possible for unauthenticated attackers to read and exfiltrate arbitrary files readable by the web server process via path traversal sequences in the mfile[] parameter, with files being disclosed as email attachments. Note: This vulnerability is limited to the 'wp-content' folder due to the wpcf7_is_file_path_in_content_dir() function in the Contact Form 7 plugin.
The Drag and Drop Multiple File Upload for Contact Form 7 WordPress plugin (versions ≤1.3.9.6) contains a critical path traversal vulnerability allowing unauthenticated attackers to read and exfiltrate arbitrary files from the wp-content directory via unsanitized mfile[] POST parameters. Files are disclosed as email attachments, enabling exposure of sensitive configuration files, database backups, and plugin source code. No patch is currently available, requiring immediate mitigation through plugin disablement or compensating controls.
IMMEDIATE ACTIONS:
1. Disable and deactivate the 'Drag and Drop Multiple File Upload for Contact Form 7' plugin immediately across all WordPress installations
2. Remove the plugin files from wp-content/plugins/ directory
3. Review server logs (access.log, error.log) for suspicious mfile[] parameter patterns indicating exploitation attempts
4. Search for POST requests containing 'mfile[' with path traversal sequences (../, ..\, encoded variants)
FILE INTEGRITY VERIFICATION:
5. Audit wp-content directory for unauthorized file access or exfiltration (check file modification times, access logs)
6. Review email logs for suspicious attachments sent via Contact Form 7 in past 90 days
7. Verify integrity of wp-config.php, .htaccess, and other sensitive files in wp-content
COMPENSATING CONTROLS (until patch available):
8. Implement Web Application Firewall (WAF) rules blocking requests with mfile[] parameters containing path traversal sequences (../, .., encoded variants like %2e%2e)
9. Restrict file upload functionality at web server level using .htaccess or nginx configuration to deny access to mfile[] POST parameter processing
10. Implement strict input validation at web server level rejecting any POST requests with path traversal indicators
11. Apply principle of least privilege: ensure web server process runs with minimal permissions, restrict read access to wp-content subdirectories
DETECTION RULES:
12. Monitor for POST requests to wp-admin/admin-ajax.php or contact form endpoints containing: mfile[0], mfile[1], etc. with values containing ../, %2e%2e, or encoded path traversal
13. Alert on any file_exists() or file access operations on wp-config.php, wp-settings.php, or files outside intended upload directories
14. Monitor outbound email attachments from Contact Form 7 for unexpected file types or paths
15. Implement SIEM rules to detect multiple failed/successful path traversal attempts from same IP
ALTERNATIVES:
16. Replace with alternative file upload plugins with proven security track record (verify security audits)
17. Use Contact Form 7 without file upload functionality if not critical to business operations
18. Implement custom file upload solution with proper server-side validation, path canonicalization, and directory containment checks
الإجراءات الفورية:
1. قم بتعطيل وإلغاء تنشيط مكون 'Drag and Drop Multiple File Upload for Contact Form 7' فوراً عبر جميع تثبيتات WordPress
2. احذف ملفات المكون الإضافي من مجلد wp-content/plugins/
3. راجع سجلات الخادم (access.log, error.log) للبحث عن أنماط معاملات mfile[] المريبة التي تشير إلى محاولات الاستغلال
4. ابحث عن طلبات POST تحتوي على 'mfile[' مع تسلسلات اجتياز المسار (../, ..\, متغيرات مشفرة)
تحقق من سلامة الملفات:
5. قم بتدقيق مجلد wp-content للبحث عن الوصول غير المصرح به أو استخراج الملفات (تحقق من أوقات تعديل الملفات وسجلات الوصول)
6. راجع سجلات البريد الإلكتروني للبحث عن المرفقات المريبة المرسلة عبر Contact Form 7 في آخر 90 يوماً
7. تحقق من سلامة wp-config.php و .htaccess والملفات الحساسة الأخرى في wp-content
عناصر التحكم التعويضية (حتى توفر التصحيح):
8. قم بتنفيذ قواعد جدار حماية تطبيقات الويب (WAF) لحظر الطلبات التي تحتوي على معاملات mfile[] تحتوي على تسلسلات اجتياز المسار (../, .., متغيرات مشفرة مثل %2e%2e)
9. قيد وظيفة تحميل الملفات على مستوى خادم الويب باستخدام .htaccess أو تكوين nginx لرفض الوصول إلى معالجة معامل POST mfile[]
10. قم بتنفيذ التحقق الصارم من المدخلات على مستوى خادم الويب برفض أي طلبات POST تحتوي على مؤشرات اجتياز المسار
11. طبق مبدأ أقل امتياز: تأكد من أن عملية خادم الويب تعمل بأقل صلاحيات، قيد الوصول للقراءة إلى مجلدات فرعية في wp-content
قواعد الكشف:
12. راقب طلبات POST إلى wp-admin/admin-ajax.php أو نقاط نهاية نماذج الاتصال التي تحتوي على: mfile[0], mfile[1], إلخ. مع قيم تحتوي على ../, %2e%2e، أو اجتياز مسار مشفر
13. أصدر تنبيهات لأي عمليات file_exists() أو الوصول إلى الملفات على wp-config.php, wp-settings.php، أو ملفات خارج مجلدات التحميل المقصودة
14. راقب مرفقات البريد الإلكتروني الصادرة من Contact Form 7 للبحث عن أنواع ملفات أو مسارات غير متوقعة
15. قم بتنفيذ قواعد SIEM للكشف عن محاولات اجتياز مسار متعددة فاشلة/ناجحة من نفس عنوان IP
بدائل:
16. استبدل بمكونات إضافية بديلة لتحميل الملفات بسجل أمان مثبت (تحقق من عمليات التدقيق الأمني)
17. استخدم Contact Form 7 بدون وظيفة تحميل الملفات إذا لم تكن حرجة لعمليات العمل
18. قم بتنفيذ حل تحميل ملفات مخصص مع التحقق الصحيح من جانب الخادم وتطبيع المسار والتحقق من احتواء المجلد