The WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance plugin for WordPress is vulnerable to arbitrary file deletion due to insufficient file path validation in the unscheduled_original_file_deletion function in all versions up to, and including, 4.5.2 This makes it possible for authenticated attackers, with author-level access and above, to delete arbitrary files on the server, which can easily lead to remote code execution when the right file is deleted (such as wp-config.php). This is possible because 'original-file' is a public (non-protected) meta key — it does not begin with an underscore — allowing Authors to freely create or modify it on their own attachment posts via the standard Edit Media form or the REST API.
WP-Optimize plugin versions up to 4.5.2 contain a critical arbitrary file deletion vulnerability (CVE-2026-7252) affecting WordPress installations. Authenticated users with author-level privileges can exploit insufficient path validation to delete arbitrary files, potentially leading to remote code execution by targeting critical files like wp-config.php. This vulnerability poses significant risk to Saudi organizations relying on WordPress for web presence, particularly those with multiple content contributors.
IMMEDIATE ACTIONS:
1. Disable WP-Optimize plugin immediately via WordPress admin dashboard or file system
2. Audit user accounts with author-level access or above; review recent file modifications and deletions
3. Check server logs for suspicious file deletion attempts in wp-content/plugins/wp-optimize/ directory
4. Verify integrity of critical files: wp-config.php, .htaccess, wp-settings.php
PATCHING GUIDANCE:
1. Monitor WP-Optimize GitHub repository and official plugin page for security patch release
2. Do not update to any version until patch is confirmed and tested in staging environment
3. When patch becomes available, test thoroughly before production deployment
COMPENSATING CONTROLS (until patch available):
1. Restrict author-level access to only trusted, vetted users
2. Implement file system permissions: set wp-config.php to 400 (read-only for owner)
3. Use Web Application Firewall (WAF) rules to block suspicious file deletion patterns
4. Enable WordPress security plugins (Wordfence, Sucuri) with file integrity monitoring
5. Implement database activity logging for attachment metadata modifications
6. Use version control (Git) for wp-config.php and critical files with automated alerts
DETECTION RULES:
1. Monitor REST API calls to /wp-json/wp/v2/media with POST/PUT methods modifying 'original-file' meta
2. Alert on file deletion attempts in WordPress root and wp-content directories
3. Log all attachment post modifications by author-level users
4. Monitor for wp-config.php access/deletion attempts
5. Track unscheduled_original_file_deletion function calls in error logs
الإجراءات الفورية:
1. تعطيل مكون WP-Optimize فوراً من لوحة تحكم WordPress أو نظام الملفات
2. تدقيق حسابات المستخدمين على مستوى المؤلف أو أعلى؛ مراجعة التعديلات والحذف الأخيرة
3. فحص سجلات الخادم للمحاولات المريبة لحذف الملفات
4. التحقق من سلامة الملفات الحرجة: wp-config.php و .htaccess و wp-settings.php
إرشادات التصحيح:
1. مراقبة مستودع WP-Optimize الرسمي لإصدار تصحيح أمني
2. عدم التحديث إلى أي إصدار حتى يتم تأكيد التصحيح واختباره
3. عند توفر التصحيح، اختبره بدقة قبل النشر في الإنتاج
الضوابط البديلة (حتى توفر التصحيح):
1. تقييد الوصول على مستوى المؤلف للمستخدمين الموثوقين فقط
2. تطبيق أذونات نظام الملفات: تعيين wp-config.php إلى 400
3. استخدام جدار حماية تطبيقات الويب (WAF) لحظر أنماط حذف الملفات المريبة
4. تفعيل مكونات أمان WordPress مع مراقبة سلامة الملفات
5. تطبيق تسجيل نشاط قاعدة البيانات لتعديلات بيانات المرفقات
6. استخدام التحكم بالإصدارات (Git) للملفات الحرجة مع التنبيهات الآلية