Secure WordPress user registration: roles and email

Written by

in

Many attacks don’t force anything: they exploit open registration or a plugin that creates users. They give themselves a high role. A secure WordPress user registration starts by deciding who can become what. The plugin’s User registration section does exactly that.

WordPress user registration: a user icon next to three lines ending in circles of increasing size

Three WordPress user registration policies

WordPress user registration here follows one of three policies:

  1. No restriction.
  2. Low-privilege roles only: never administrator, editor, author or shop_manager.
  3. Registration switched off entirely.

The second one is on by default. As soon as it is installed, the plugin already prevents the creation of high-privilege accounts, even if the configuration is wrong. The official documentation on roles and capabilities explains what each default role can do.

Whichever door they come in through

The WordPress user registration policy uses WordPress’s central filter for user creation. So it covers wp-admin, the REST API, XML-RPC, WP-CLI and direct calls from third-party plugins or themes. As a safety net, an account created while the policy was active with permissions it shouldn’t have loses them immediately. That holds whichever way it came in.

Always a valid email at WordPress user registration

A separate switch for WordPress user registration prevents users being created without a valid email address, from any route. Accounts without an email are hard to contact and to recognise: with email required, every user can be traced.

A typical case

An online shop with a vulnerable WordPress user registration plugin: the attacker tries to register asking for the administrator role. With the low-privilege roles policy the request does not produce an administrator. Another scenario stays out of reach: a vulnerability that edits the database directly bypasses the policy. It doesn’t go through user creation.

Creation, deletion and role changes end up in the activity log, which is useful for reconstructing what happened.

Frequently asked questions

How do I stop someone registering as an administrator?

With the low-privilege roles policy, on by default: administrator, editor, author and shop_manager cannot be created.

Does it also apply to creations by plugins or WP-CLI?

Yes, it covers wp-admin, the REST API, XML-RPC, WP-CLI and direct calls from plugins and themes.

Is email mandatory for WordPress user registration?

With the dedicated switch on, yes: no user can be created without a valid email address.

Read more

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

WordPress Cookie Notice by Real Cookie Banner