Fix: Prevent registration bypass when user registration is disabled #8258
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix: Prevent registration bypass when user registration is disabled
Problem Description:
After extensive testing, I discovered a potential vulnerability in the default WordPress registration form. This issue occurs even when user registration is disabled (
users_can_registerset to0). It allows spammers to bypass the restriction and create accounts, resulting in spam registrations and automated email notifications.Steps to Reproduce:
/wp-login.php?action=register.application/x-www-form-urlencodedx-www-form-urlencoded):user_login=testuser user_email=testuser@example.com user_pass=TestPassword123 wp-submit=Register redirect_to=If the same request is repeated, an error is displayed indicating that the username and email are already in use.
The bypass works only when redirect following is disabled.
Root Cause:
The
wp-login.phpfile does not validate whether theusers_can_registeroption is disabled when processing registration requests.Solution:
This pull request introduces a check to block access to the registration process if the
Trac ticket: https://core.trac.wordpress.org/ticket/62905users_can_registeroption is set to0. This ensures that no new accounts can be created through this endpoint unless registration is explicitly enabled.