The Contest Gallery plugin for WordPress is vulnerable to SQL Injection via the 'form_input' parameter in versions up to, and including, 28.1.6. This is due to insufficient escaping on the user supplied parameter and lack of sufficient preparation on the existing SQL query inside the unauthenticated 'post_cg_gallery_form_upload' AJAX action (specifically the 'cb' branch of the included users-upload-check.php, where $f_input_id is concatenated unquoted into 'SELECT Field_Content FROM ... WHERE id = $f_input_id'). The endpoint is gated only by a public frontend nonce ('cg1l_action' / 'cg_nonce') that is exposed in the page source of any public gallery page. This makes it possible for unauthenticated attackers to append additional SQL queries into already existing queries that can be used to extract sensitive information from the database.
CVE-2026-8912 is a critical SQL Injection vulnerability in the Contest Gallery WordPress plugin (versions ≤28.1.6) affecting unauthenticated users. The vulnerability exists in the 'post_cg_gallery_form_upload' AJAX action where the 'form_input' parameter is insufficiently escaped, allowing attackers to extract sensitive database information. The vulnerability is particularly severe as it requires only a publicly exposed nonce found in page source, making exploitation trivial for any attacker with access to a WordPress site using this plugin.
IMMEDIATE ACTIONS:
1. Identify all WordPress installations using Contest Gallery plugin version 28.1.6 or earlier across your organization
2. Disable the plugin immediately: wp-cli plugin deactivate contest-gallery or via WordPress admin dashboard
3. If plugin functionality is critical, isolate affected WordPress instances from production networks
PATCHING GUIDANCE:
1. Monitor the official Contest Gallery plugin repository for security updates (currently no patch available as of CVE publication)
2. Contact plugin developers for patch timeline and interim security measures
3. Once patch is released, test in staging environment before production deployment
4. Implement Web Application Firewall (WAF) rules to block SQL injection patterns targeting the vulnerable endpoint
COMPENSATING CONTROLS (until patch available):
1. Implement database-level access controls: restrict database user permissions to minimum required privileges
2. Enable WordPress security plugins (Wordfence, Sucuri) with SQL injection detection rules
3. Apply ModSecurity rules blocking SQL injection patterns in POST requests to /wp-admin/admin-ajax.php
4. Implement rate limiting on AJAX endpoints to prevent automated exploitation
5. Monitor database query logs for suspicious patterns: UNION SELECT, OR 1=1, SLEEP(), BENCHMARK()
6. Restrict access to WordPress admin-ajax.php to known IP ranges if possible
7. Implement Content Security Policy (CSP) headers to limit data exfiltration
DETECTION RULES:
1. Monitor for POST requests to /wp-admin/admin-ajax.php with action=post_cg_gallery_form_upload containing SQL keywords (UNION, SELECT, OR, AND, SLEEP, BENCHMARK)
2. Alert on database queries containing concatenated user input in WHERE clauses
3. Monitor for unusual database access patterns or large data extractions
4. Log all AJAX requests with form_input parameter values for forensic analysis
5. Implement IDS/IPS signatures for SQL injection attempts targeting this specific endpoint
الإجراءات الفورية:
1. حدد جميع تثبيتات WordPress التي تستخدم إضافة Contest Gallery الإصدار 28.1.6 أو أقدم عبر مؤسستك
2. عطّل الإضافة فوراً: wp-cli plugin deactivate contest-gallery أو عبر لوحة تحكم WordPress
3. إذا كانت وظيفة الإضافة حرجة، عزل تثبيتات WordPress المتأثرة عن شبكات الإنتاج
إرشادات التصحيح:
1. راقب مستودع إضافة Contest Gallery الرسمي للتحديثات الأمنية (لا يوجد تصحيح متاح حالياً)
2. اتصل بمطوري الإضافة للحصول على جدول زمني للتصحيح والتدابير الأمنية المؤقتة
3. بمجرد إصدار التصحيح، اختبره في بيئة التطوير قبل نشره في الإنتاج
4. طبّق قواعد جدار حماية تطبيقات الويب (WAF) لحظر أنماط حقن SQL التي تستهدف نقطة النهاية الضعيفة
الضوابط البديلة (حتى توفر التصحيح):
1. طبّق ضوابط الوصول على مستوى قاعدة البيانات: قيّد أذونات مستخدم قاعدة البيانات للحد الأدنى المطلوب
2. فعّل إضافات أمان WordPress (Wordfence, Sucuri) مع قواعد كشف حقن SQL
3. طبّق قواعد ModSecurity لحظر أنماط حقن SQL في طلبات POST إلى /wp-admin/admin-ajax.php
4. طبّق تحديد معدل على نقاط نهاية AJAX لمنع الاستغلال الآلي
5. راقب سجلات استعلامات قاعدة البيانات للأنماط المريبة: UNION SELECT, OR 1=1, SLEEP(), BENCHMARK()
6. قيّد الوصول إلى WordPress admin-ajax.php إلى نطاقات IP معروفة إن أمكن
7. طبّق رؤوس سياسة أمان المحتوى (CSP) لتحديد تسرب البيانات
قواعد الكشف:
1. راقب طلبات POST إلى /wp-admin/admin-ajax.php مع action=post_cg_gallery_form_upload التي تحتوي على كلمات SQL (UNION, SELECT, OR, AND, SLEEP, BENCHMARK)
2. أصدر تنبيهات لاستعلامات قاعدة البيانات التي تحتوي على إدخال المستخدم المسلسل في جمل WHERE
3. راقب أنماط الوصول غير العادية إلى قاعدة البيانات أو استخراج البيانات الكبيرة
4. سجّل جميع طلبات AJAX مع قيم معامل form_input للتحليل الجنائي
5. طبّق توقيعات IDS/IPS لمحاولات حقن SQL التي تستهدف نقطة النهاية المحددة هذه