Contest Gallery WordPress Plugin SQL Injection Vulnerability (CVE-2026-8912)
The Contest Gallery plugin for WordPress is vulnerable to SQL Injection via the 'form_input' parameter in versions up to 28.1.6, allowing unauthenticated attackers to extract sensitive information from the database.
The Contest Gallery plugin for WordPress is susceptible to SQL Injection attacks due to insufficient input sanitization of the ‘form_input’ parameter. This vulnerability affects versions up to and including 28.1.6. The flaw resides within the ‘post_cg_gallery_form_upload’ AJAX action, specifically in the ‘cb’ branch of the included users-upload-check.php file. The ‘$f_input_id’ variable is concatenated without proper quoting into a SQL query (‘SELECT Field_Content FROM … WHERE id = $f_input_id’), creating an injection point. The only protection is a public frontend nonce (‘cg1l_action’ / ‘cg_nonce’) exposed in the page source, which an attacker can easily obtain, bypass and then inject arbitrary SQL queries to extract database information.
Attack Chain
- Attacker identifies a target WordPress site using Contest Gallery plugin version <= 28.1.6.
- Attacker retrieves the ‘cg1l_action’ / ‘cg_nonce’ value from the HTML source of a public gallery page on the target site.
- Attacker crafts a malicious HTTP POST request to the ‘wp-admin/admin-ajax.php’ endpoint, targeting the ‘post_cg_gallery_form_upload’ action.
- The request includes the ‘action’ parameter set to ‘post_cg_gallery_form_upload’ and the ‘form_input’ parameter containing a SQL injection payload.
- The server executes the crafted SQL query, which includes the attacker’s injected SQL code, without proper sanitization.
- The attacker leverages the SQL injection to extract sensitive data, such as user credentials, configuration details, or other confidential information from the WordPress database.
- The extracted data is returned to the attacker in the HTTP response.
- Attacker uses the extracted information for further malicious activities, such as unauthorized access, data exfiltration, or lateral movement within the network.
Impact
Successful exploitation of this SQL Injection vulnerability (CVE-2026-8912) allows unauthenticated attackers to directly query the WordPress database. This can lead to the exposure of sensitive data, including user credentials, API keys, and other confidential information stored in the database. The impact can range from data breaches and unauthorized access to complete compromise of the WordPress site and its associated data.
Recommendation
- Apply available updates for the Contest Gallery plugin for WordPress to version greater than 28.1.6 to patch CVE-2026-8912.
- Deploy the Sigma rule
Detect CVE-2026-8912 Exploitation — WordPress Contest Gallery SQLito detect exploitation attempts based on specific URI patterns. - Monitor web server logs for suspicious POST requests to ‘wp-admin/admin-ajax.php’ with SQL injection attempts in the ‘form_input’ parameter as covered by the
Detect CVE-2026-8912 Exploitation — WordPress Contest Gallery SQLiSigma rule.
Detection coverage 2
Detect CVE-2026-8912 Exploitation — WordPress Contest Gallery SQLi
highDetects CVE-2026-8912 exploitation — attempts to exploit SQL injection in the WordPress Contest Gallery plugin by detecting suspicious POST requests to wp-admin/admin-ajax.php with SQL syntax in the form_input parameter.
Detect WordPress AJAX SQLi via Public Nonce
mediumDetects generic WordPress AJAX SQL Injection attempts using a publicly accessible nonce, indicating a potential exploit of vulnerabilities like CVE-2026-8912.
Detection queries are available on the platform. Get full rules →