The Contest Gallery plugin for WordPress is vulnerable to an authentication bypass leading to admin account takeover in all versions up to, and including, 28.1.5. This is due to the email confirmation handler in `users-registry-check-after-email-or-pin-confirmation.php` using the user's email string in a `WHERE ID = %s` clause instead of the numeric user ID, combined with an unauthenticated key-based login endpoint in `ajax-functions-frontend.php`. When the non-default `RegMailOptional=1` setting is enabled, an attacker can register with a crafted email starting with the target user ID (e.g., `1poc@example.test`), trigger the confirmation flow to overwrite the admin's `user_activation_key` via MySQL integer coercion, and then use the `post_cg1l_login_user_by_key` AJAX action to authenticate as the admin without any credentials. This makes it possible for unauthenticated attackers to take over any WordPress administrator account and gain full site control.
CVE-2026-4021 is a critical authentication bypass vulnerability in the Contest Gallery WordPress plugin (versions ≤28.1.5) that allows unauthenticated attackers to take over administrator accounts through email confirmation handler exploitation and MySQL integer coercion. When the non-default RegMailOptional setting is enabled, attackers can register with a crafted email, overwrite the admin's activation key, and gain full site control via an unauthenticated AJAX login endpoint. With no patch currently available and no exploit publicly disclosed, immediate mitigation is essential for all affected WordPress installations in Saudi Arabia.
IMMEDIATE ACTIONS:
1. Disable the Contest Gallery plugin immediately: Navigate to WordPress admin > Plugins > Contest Gallery > Deactivate and Delete
2. If plugin functionality is critical, isolate the affected WordPress instance from production until patching is available
3. Change all WordPress administrator account passwords immediately
4. Review user accounts for unauthorized admin accounts created in the past 30 days
5. Check WordPress user_activation_key values in wp_users table for suspicious modifications
DETECTION & INVESTIGATION:
6. Search WordPress logs and web server logs for POST requests to /wp-admin/admin-ajax.php with action=post_cg1l_login_user_by_key
7. Monitor for user registrations with emails matching pattern: ^[0-9]+[a-zA-Z0-9._%+-]*@.*$ (numeric prefix emails)
8. Check wp_usermeta table for recent user_activation_key changes
9. Review wp_users table for accounts with user_registered dates matching suspicious activity timeframes
COMPENSATING CONTROLS (if plugin cannot be immediately removed):
10. Disable user registration entirely via Settings > General > Membership unchecked
11. Disable the RegMailOptional setting if accessible in plugin settings
12. Implement Web Application Firewall (WAF) rules to block requests to post_cg1l_login_user_by_key AJAX action
13. Restrict /wp-admin/admin-ajax.php access to authenticated users only via .htaccess or nginx configuration
14. Implement IP whitelisting for WordPress admin access
15. Enable two-factor authentication (2FA) on all administrator accounts using plugins like Wordfence or Google Authenticator
LONG-TERM REMEDIATION:
16. Monitor the Contest Gallery plugin repository for security updates and apply immediately when available
17. Consider replacing Contest Gallery with alternative, actively maintained plugins
18. Implement WordPress security hardening: disable file editing, restrict plugin/theme uploads, implement regular backups
19. Deploy WordPress security monitoring solution (Wordfence, Sucuri, or equivalent) with real-time threat detection
20. Conduct full WordPress security audit including database integrity verification
DETECTION RULES (for SIEM/WAF):
- Alert on POST requests to admin-ajax.php with action=post_cg1l_login_user_by_key
- Alert on user registrations with email addresses starting with numeric characters
- Alert on wp_users table modifications to user_activation_key field outside normal change windows
- Alert on successful logins immediately following user registration with numeric-prefix emails
الإجراءات الفورية:
1. قم بتعطيل إضافة Contest Gallery فوراً: انتقل إلى لوحة تحكم WordPress > الإضافات > Contest Gallery > إلغاء التفعيل والحذف
2. إذا كانت وظائف الإضافة حرجة، قم بعزل مثيل WordPress المتأثر عن الإنتاج حتى يتوفر التصحيح
3. غيّر كلمات مرور جميع حسابات مسؤول WordPress فوراً
4. راجع حسابات المستخدمين للبحث عن حسابات مسؤول غير مصرح بها تم إنشاؤها في آخر 30 يوماً
5. تحقق من قيم user_activation_key في جدول wp_users للتعديلات المريبة
الكشف والتحقيق:
6. ابحث في سجلات WordPress وسجلات خادم الويب عن طلبات POST إلى /wp-admin/admin-ajax.php مع action=post_cg1l_login_user_by_key
7. راقب تسجيلات المستخدمين ببريد إلكتروني يطابق النمط: ^[0-9]+[a-zA-Z0-9._%+-]*@.*$ (رسائل بريد إلكترونية بادئة رقمية)
8. تحقق من جدول wp_usermeta للتغييرات الأخيرة في user_activation_key
9. راجع جدول wp_users للحسابات ذات تواريخ user_registered المطابقة لأطر النشاط المريب
الضوابط التعويضية (إذا لم يتمكن من إزالة الإضافة فوراً):
10. قم بتعطيل تسجيل المستخدم بالكامل عبر الإعدادات > عام > عضوية غير محددة
11. قم بتعطيل إعداد RegMailOptional إن أمكن في إعدادات الإضافة
12. تنفيذ قواعد جدار حماية تطبيقات الويب (WAF) لحظر الطلبات إلى إجراء AJAX post_cg1l_login_user_by_key
13. تقييد الوصول إلى /wp-admin/admin-ajax.php للمستخدمين المصرح لهم فقط عبر .htaccess أو تكوين nginx
14. تنفيذ القائمة البيضاء للعناوين IP لوصول مسؤول WordPress
15. تفعيل المصادقة متعددة العوامل (2FA) على جميع حسابات المسؤول باستخدام إضافات مثل Wordfence أو Google Authenticator
التخفيف طويل الأجل:
16. راقب مستودع إضافة Contest Gallery للتحديثات الأمنية وطبقها فوراً عند توفرها
17. فكر في استبدال Contest Gallery بإضافات بديلة يتم صيانتها بنشاط
18. تنفيذ تقسية أمان WordPress: تعطيل تحرير الملفات، تقييد تحميل الإضافات/المواضيع، تنفيذ النسخ الاحتياطية المنتظمة
19. نشر حل مراقبة أمان WordPress (Wordfence أو Sucuri أو ما يعادله) مع الكشف عن التهديدات في الوقت الفعلي
20. إجراء تدقيق أمان WordPress كامل بما في ذلك التحقق من سلامة قاعدة البيانات