CVE-2026-4021
Received Received - Intake
Authentication Bypass in Contest Gallery Plugin Enables Admin Takeover

Publication date: 2026-03-24

Last updated on: 2026-03-24

Assigner: Wordfence

Description
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., `[email protected]`), 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.
CVSS Scores
EPSS Scores
Probability:
Percentile:
Meta Information
Published
2026-03-24
Last Modified
2026-03-24
Generated
2026-05-07
AI Q&A
2026-03-24
EPSS Evaluated
2026-05-05
NVD
EUVD
Affected Vendors & Products
Showing 2 associated CPEs
Vendor Product Version / Range
wordfence contest_gallery to 28.1.5 (inc)
contest_gallery plugin to 28.1.5 (inc)
Helpful Resources
Exploitability
CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-287 When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?

The Contest Gallery plugin for WordPress has a vulnerability that allows an attacker to bypass authentication and take over administrator accounts. This happens because the plugin's email confirmation handler incorrectly uses the user's email string in a database query where a numeric user ID is expected. When a specific setting (`RegMailOptional=1`) is enabled, an attacker can register with a specially crafted email that starts with the target user's ID, causing the plugin to overwrite the admin's activation key due to MySQL integer coercion.

After this, the attacker can use an unauthenticated AJAX login endpoint to authenticate as the admin without any credentials, effectively gaining full control over the WordPress site.


How can this vulnerability impact me? :

This vulnerability can have severe impacts as it allows unauthenticated attackers to take over any WordPress administrator account on a site using the vulnerable Contest Gallery plugin versions up to 28.1.5.

  • Full site control by the attacker, including the ability to modify content, install malicious plugins or themes, and access sensitive data.
  • Potential loss of data integrity and confidentiality.
  • Compromise of the entire WordPress installation and any connected systems.

How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:

I don't know


How can this vulnerability be detected on my network or system? Can you suggest some commands?

[{'type': 'paragraph', 'content': 'This vulnerability involves an authentication bypass in the Contest Gallery WordPress plugin via crafted email registration and misuse of the activation key login AJAX endpoint.'}, {'type': 'paragraph', 'content': 'Detection can focus on monitoring for suspicious AJAX requests to the `post_cg1l_login_user_by_key` action, which allows login via activation key without credentials.'}, {'type': 'paragraph', 'content': 'You can inspect web server logs or use network monitoring tools to look for POST requests to URLs containing `ajax-functions-frontend.php` with the parameter `action=post_cg1l_login_user_by_key`.'}, {'type': 'list_item', 'content': "Use command-line tools like `grep` on your web server access logs to find such requests, for example: `grep 'post_cg1l_login_user_by_key' /var/log/apache2/access.log`"}, {'type': 'list_item', 'content': 'Look for suspicious registration emails with crafted email addresses starting with numeric user IDs (e.g., `[email protected]`) in your mail logs.'}, {'type': 'list_item', 'content': 'Check for unexpected changes or overwrites of the `user_activation_key` field in the WordPress users database table, which may indicate exploitation attempts.'}, {'type': 'paragraph', 'content': 'No specific detection commands are provided in the available resources, but monitoring AJAX login attempts and unusual user activation key changes are recommended.'}] [2, 3]


What immediate steps should I take to mitigate this vulnerability?

The primary mitigation is to update the Contest Gallery plugin to version 28.1.6 or later, where the vulnerability has been fixed.

The fix involves correcting the misuse of the email string in the SQL query and securing the activation key login endpoint to prevent unauthenticated access.

Until the update can be applied, consider disabling or restricting access to the vulnerable AJAX endpoint `post_cg1l_login_user_by_key` in `ajax-functions-frontend.php` to prevent exploitation.

Additionally, review and tighten user registration settings, especially the `RegMailOptional=1` setting, which enables the attack vector.

Monitor and audit user accounts for unauthorized changes, particularly admin accounts, and reset passwords or activation keys if suspicious activity is detected.


Ask Our AI Assistant
Need more information? Ask your question to get an AI reply (Powered by our expertise)
0/70
EPSS Chart