Our Proactive Monitoring Caught an Authenticated Arbitrary File Upload Vulnerability in PollDeep
One of the ways we help to improve the security of WordPress plugins, not just for our customers, but for everyone using them, is the proactive monitoring of changes made to plugins in the Plugin Directory to try to catch serious vulnerabilities. Through that we caught an authenticated arbitrary file upload vulnerability in to the plugin PollDeep.
This vulnerability isn’t all that complicated. The plugin registers the function polldeep_upload_files_to_polldeep() to accessible by anyone logged in to WordPress:
75 | add_action('wp_ajax_polldeep_upload_files_to_polldeep', 'polldeep_upload_files_to_polldeep' ); |
That occurs in the file /upload.php and the function is also located in that file. The first code in the function will save a file sent with the name “poll_background_image_file” to the directory /wp-content/plugins/polldeep/images/ if it exists and there is not an error associated with it:
2 3 4 5 6 7 8 9 10 11 | function polldeep_upload_files_to_polldeep() { global $polldeepServer; if(isset($_FILES["poll_background_image_file"]) && $_FILES["poll_background_image_file"]["error"] > 0) { $error=$_FILES["poll_background_image_file"]["error"]; } else if(isset($_FILES["poll_background_image_file"])){ move_uploaded_file($_FILES["poll_background_image_file"]["tmp_name"], dirname(__FILE__).'/images/'. $_FILES["poll_background_image_file"]["name"]); |
There are multiple security checks missing there. It looks like the functionality is only intended to accessible to WordPress users with the “manage_options” capability (so Administrators), but there is not capabilities check. There also should be a nonce check to prevent cross-site request forgery (CSRF). Finally, there should a restriction on what kinds of files can be uploaded as it looks like the only images are intended to be allowed there.
Right after that code in the function is nearly identical code that also permits the upload of arbitrary files.
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:
Proof of Concept
The following proof of concept will place the uploaded file in to the directory /wp-content/plugins/polldeep/images/ of the website, 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=polldeep_upload_files_to_polldeep" method="POST" enctype="multipart/form-data"> <input type="file" name="poll_background_image_file" /> <input type="submit" value="Submit" /> </form> </body> </html>
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.