The Perfmatters plugin for WordPress is vulnerable to arbitrary file overwrite via path traversal in all versions up to, and including, 2.5.9. This is due to the `PMCS::action_handler()` method processing the bulk action `activate`/`deactivate` handlers without any authorization check or nonce verification. The `$_GET['snippets'][]` values are passed unsanitized to `Snippet::activate()`/`Snippet::deactivate()` which call `Snippet::update()` then `file_put_contents()` with the traversed path. This makes it possible for authenticated attackers, with Subscriber-level access and above, to overwrite arbitrary files on the server with a fixed PHP docblock content, potentially causing denial of service by corrupting critical files like `.htaccess` or `index.php`.
CVE-2026-4351 is a critical path traversal vulnerability in the Perfmatters WordPress plugin (versions ≤2.5.9) that allows authenticated users with Subscriber-level access to overwrite arbitrary files on web servers. The vulnerability exploits insufficient input validation in the bulk action handler, enabling attackers to corrupt critical files like .htaccess or index.php, causing denial of service. With no patch currently available, this poses an immediate threat to WordPress installations across Saudi Arabia's digital infrastructure.
IMMEDIATE ACTIONS:
1. Audit all WordPress installations using Perfmatters plugin version 2.5.9 or earlier across your organization
2. Disable the Perfmatters plugin immediately by renaming the plugin directory or deactivating through WordPress admin
3. Review file modification logs (access logs, file integrity monitoring) for suspicious file_put_contents() calls to .htaccess, index.php, wp-config.php, and other critical files
4. Check for unauthorized file modifications in the past 30-90 days, particularly files with PHP docblock content
COMPENSATING CONTROLS (until patch available):
5. Implement strict file permissions: set wp-config.php, .htaccess, and index.php to read-only (644 or 444)
6. Restrict file_put_contents() function via php.ini or disable_functions directive
7. Implement Web Application Firewall (WAF) rules to block requests containing path traversal patterns (../, ..\ ) in GET parameters
8. Enforce strong authentication: disable Subscriber-level access for non-essential users; require multi-factor authentication
9. Implement file integrity monitoring (FIM) on critical WordPress files to detect unauthorized modifications in real-time
10. Configure WordPress to prevent direct file editing: add define('DISALLOW_FILE_EDIT', true); to wp-config.php
DETECTION RULES:
11. Monitor for HTTP requests with 'snippets[]' parameter containing path traversal sequences
12. Alert on file_put_contents() calls originating from wp-admin/admin-ajax.php with action=pmcs_handler
13. Monitor for modifications to .htaccess, index.php, wp-config.php, and wp-load.php files
14. Log all bulk action requests and correlate with file modification timestamps
PATCHING STRATEGY:
15. Monitor Perfmatters official repository for security patch release
16. Once patch is available, test in staging environment before production deployment
17. If plugin is no longer maintained, consider migration to alternative code snippet management solutions
الإجراءات الفورية:
1. تدقيق جميع تثبيتات WordPress التي تستخدم مكون Perfmatters الإصدار 2.5.9 أو أقدم عبر مؤسستك
2. تعطيل مكون Perfmatters فوراً بإعادة تسمية دليل المكون أو إلغاء التفعيل من خلال لوحة تحكم WordPress
3. مراجعة سجلات تعديل الملفات (سجلات الوصول، مراقبة سلامة الملفات) للبحث عن استدعاءات file_put_contents() المريبة
4. التحقق من التعديلات غير المصرح بها على الملفات في آخر 30-90 يوماً
الضوابط التعويضية (حتى توفر التصحيح):
5. تطبيق أذونات ملفات صارمة: اضبط wp-config.php و .htaccess و index.php على القراءة فقط
6. تقييد وظيفة file_put_contents() عبر php.ini أو توجيه disable_functions
7. تطبيق قواعد جدار حماية تطبيقات الويب (WAF) لحظر الطلبات التي تحتوي على أنماط اجتياز المسار
8. فرض مصادقة قوية: تعطيل وصول مستوى المشترك للمستخدمين غير الأساسيين
9. تطبيق مراقبة سلامة الملفات (FIM) على ملفات WordPress الحرجة
10. تكوين WordPress لمنع تحرير الملفات المباشر: أضف define('DISALLOW_FILE_EDIT', true);
قواعد الكشف:
11. مراقبة طلبات HTTP التي تحتوي على معامل 'snippets[]' يحتوي على تسلسلات اجتياز المسار
12. تنبيه عند استدعاءات file_put_contents() الناشئة من wp-admin/admin-ajax.php
13. مراقبة التعديلات على الملفات الحرجة
14. تسجيل جميع طلبات الإجراء الجماعي والربط مع طوابع زمن تعديل الملفات
استراتيجية التصحيح:
15. مراقبة مستودع Perfmatters الرسمي لإصدار تصحيح أمني
16. عند توفر التصحيح، اختبره في بيئة التطوير قبل نشره في الإنتاج
17. إذا لم يعد المكون مدعوماً، فكر في الهجرة إلى حلول بديلة