Cross-Site Request Forgery (CSRF) Vulnerability in ARPrice Lite
The latest update of the WordPress plugin ARPrice Lite was flagged by our proactive monitoring of changes made to plugins in the Plugin Directory to try to catch serious vulnerabilities. When went to look into that we found that the plugin was closed on the Plugin Directory on June 28 with no explanation given. The changelog for the version submitted since the closure is “WordPress standard changes and other bug fixes.”. A lot of the changes made are security related, but there still look to be quite a few issues.
There are numerous locations missing protection against cross-site request forgery (CSRF), which allows an attacker to cause someone else to take an action they didn’t intend to. As an example of that let’s look at the code that starts the import process for the plugin, part of which is what was flagged by our proactive monitoring.
When visiting the plugin’s Import/Export admin page the underlying file that generates that is /core/views/arprice_import_export.php. In that file the following code runs that saves a file sent with the request:
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | if (isset($_FILES["arp_pt_import_file"])) { global $wpdb, $WP_Filesystem; $wp_upload_dir = wp_upload_dir(); $upload_dir = $wp_upload_dir['basedir'] . '/arprice-responsive-pricing-table/import/'; $output_dir = $wp_upload_dir['basedir'] . '/arprice-responsive-pricing-table/import/'; $output_url = $wp_upload_dir['baseurl'] . '/arprice-responsive-pricing-table/import/'; if (!is_dir($output_dir)) wp_mkdir_p($output_dir); $extexp = explode(".", $_FILES["arp_pt_import_file"]["name"]); $ext = $extexp[count($extexp) - 1]; //Filter the file types , if you want. if (strtolower($ext) == "txt") { if ($_FILES["arp_pt_import_file"]["error"] > 0) { echo "Error: " . $_FILES["file"]["error"] . " "; } else { if (move_uploaded_file($_FILES["arp_pt_import_file"]["tmp_name"], $output_dir . $_FILES["arp_pt_import_file"]["name"])) { |
Other code on the page will then cause the rest of the import process to occur using the uploaded file.
There should be a check for a valid nonce in that code, otherwise an attacker could cause a logged in Administrator to unintentionally upload a file and then the import process continues.
The code does limit what types of files can be uploaded, so the worst case an arbitrary file upload vulnerability isn’t present.
Full Disclosure
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 save the selected .txt file to the directory /wp-content/uploads/arprice-responsive-pricing-table/import/ and the attempt to import it, when logged in as an Administrator.
Make sure to replace “[path to WordPress]” with the location of WordPress.
<html> <body> <form action="http://[path to WordPress]/wp-admin/admin.php?page=arplite_import_export" method="POST" enctype="multipart/form-data"> <input type="file" name="arp_pt_import_file" /> <input type="submit" value="Submit" /> </form> </body> </html>