Hackers Certainly Could Be Interested in Exploiting this Vulnerability in the Simple eCommerce WordPress Plugin
Earlier this week had what looked to be a hacker probing for usage of the WordPress plugin Simple eCommerce on our website with this request:
/wp-content/plugins/simple-e-commerce-shopping-cart/readme.txt
That plugin was closed on the WordPress Plugin Directory on June 21 for a “Security Issue.”. No additional details were provided to even confirm there was a real security issue (they have been closing plugin based on false reports recently).
What might explain a hackers interest now is a mostly false report of a vulnerability in the plugin coming from WPScan (there are a lot of those these days) that was released on August 16, as the claimed type of vulnerability is one that hackers would target, but the real vulnerability isn’t.
To make sure there wasn’t a more serious issue that hackers might be targeting that we should be alerting customer of our service about if they used the plugin, we started doing some checking of the plugin and quickly found just such an issue with the plugin. That issue being an authenticated persistent cross-site scripting (XSS) vulnerability exploitable through the plugin’s code to save its settings. That is also exploitable through cross-site request forgery (CSRF).
Testing confirms that our upcoming firewall plugin for WordPress already limited the ability of an attacker to exploit this vulnerability in the way you would normally see a hacker exploiting it in mass fashion.
Insecure Settings Saving
The plugin registers the function saveSettings() to be accessible to those logged in to WordPress through WordPress’ AJAX functionality:
210 | add_action('wp_ajax_save_settings', array('SimpleEcommCartAjax', 'saveSettings')); |
As that function, which is in the file /models/SimpleEcommCartAjax.php, handles saving the plugin’s settings, that the function should first restrict what users have access to it and check for a valid nonce to prevent CSRF, but neither exists there:
4 5 6 7 8 9 10 | public static function saveSettings() { $error = ''; foreach($_REQUEST as $key => $value) { if($key[0] != '_' && $key != 'action' && $key != 'submit') { if(is_array($value) && $key != 'admin_page_roles') { $value = implode('~', $value); } |
As the proof of concept below confirms, anyone logged in to WordPress can not only change the plugin’s settings but also can use it to store malicious JavaScript code that is then output on frontend and backed pages.
WordPress Causes Full Disclosure
Because 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).
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 cause an alert box with any available cookies to be shown on the page /wp-admin/admin.php?page=simpleecommcart-settings and fronend pages that show product prices.
Replace “[path to WordPress]” with the location of WordPress.
<html> <body> <form action="http://[path to WordPress]/wp-admin/admin-ajax.php?action=save_settings" method="POST"> <input type="hidden" name="SIMPLEECOMMCART_CURRENCY_SYMBOL_text" value="USD" /> <input type="hidden" name="SIMPLEECOMMCART_CURRENCY_SYMBOL" value='"><script>alert(document.cookie);</script>' /> <input type="submit" value="Submit" /> </form> </body> </html>