All across the internet, we find guides and tutorials on how to keep your WordPress site secure. Most of them approach the concept of user roles, but not many actually approach the capabilities of those roles.
The way the capabilities are handled on WordPress makes it quite easy to change what each role is allowed to do.
How WordPress Sets Role Capabilities
First, let’s take a look at how WordPress manages the capabilities of the roles and what they are allowed to do, such as:
- add users;
- remove users;
- create posts;
- delete posts, etc.
Role capabilities are defined in the database within the wp_options table option_name – wp_user_roles.
Attackers often focus on modifying serialized data within the wp_options table.
Since some webmasters assume that the “Subscriber” role can’t do much within a website, the risk of serialized data being tampered with can become a serious problem — attackers can leverage an attack by simply modifying the wp_user_roles field on the wp_options table as shown below:
In order to be successful, a malicious user first needs to either compromise a website or gain database access.
Attackers can quite easily give every subscriber full administration capabilities. Allow me to show you how it can be done by using the plugin Capability Manager Enhanced.
With the use of this plugin, any subscriber would be able to perform pretty much any capability they wanted without raising the webmaster’s attention. The user list would still include the same number of administrators and subscribers.
The only problem with this is that “Subscriber” is a full administrator.
If we compare it with how it is supposed to look under the default role settings, we can see how damaging this small change can be for the website.
What if instead of just one subscriber, there were hundreds, even thousands of subscribers who actually had administrator capabilities? What if you had an online shop and all of your customers became administrators?
WordPress does not have a mechanism to warn a webmaster if roles other than the “Administrator’s” have certain capabilities.
Bear in mind that Administrator-like capabilities can be set on any role present on a WordPress site. It’s very important to keep a sharp eye on what each role can do (especially post-compromise) as they can easily become a backdoor.
*** This is a Security Bloggers Network syndicated blog from Sucuri Blog authored by Cesar Anjos. Read the original post at: https://blog.sucuri.net/2018/12/using-innocent-roles-to-hide-admin-users.html