Security Audit of WordPress Plugin Apparently Missed Easy to Detect Vulnerability
The plugin Sunshine Photo Cart was closed on the WordPress Plugin Directory yesterday. We don’t know why that was, but our systems notified us of possible security related changes made after that. Those are described in the latest changes made to the plugin as “Security audit changes”. In that type of situation we usually run the previous version of the plugin through our Plugin Security Checker to see if it flagged any possible insecure code that was then fixed. When we did that, we found that possibly insecure code it flagged wasn’t fixed in the new version. Further checking confirmed there was and still is a vulnerability, despite there apparently a security audit having been done.
That code has gone unnoticed in the plugin for nearly six years, which is yet another good reason to check the plugins you use with our tool.
Reflected Cross-Site Scripting (XSS)
The Plugin Security Checker flagged this line of code in the plugin:
942 | <input type="hidden" value="<?php echo $_GET['redirect_to']; ?>" name="redirect_to" /> |
That will output the value of the GET input “redirect_to” without escaping it. Code like that is almost always insecure, so the main question is can it be accessed in a way that can be exploited.
The code runs when accessing WordPress’ registration page:
933 934 935 936 937 938 939 940 941 942 | add_action( 'register_form', 'sunshine_show_extra_register_fields' ); function sunshine_show_extra_register_fields(){ ?> <p> <label for="password"><?php _e( 'Password','sunshine' ); ?><br/> <input id="password" class="input" type="password" size="25" value="" name="password" /> </label> <label for="checkbox-unmask" class="label-unmask"><input id="checkbox-unmask" class="checkbox-unmask" type="checkbox" /><?php _e( 'Show my password', 'sunshine' ); ?></label> </p> <input type="hidden" value="<?php echo $_GET['redirect_to']; ?>" name="redirect_to" /> |
As the proof of concept below confirms, that allows for reflected cross-site scripting (XSS) to occur on the registration page.
WordPress Causes Full Disclosure
Because of the moderators of the WordPress Support Forum’s continued inappropriate behavior we changed from reasonably disclosing to full disclosing vulnerabilities for plugins in the WordPress Plugin Directory 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. (For plugins that are also in the ClassicPress Plugin Directory, we will follow our reasonable disclosure policy.) 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 cause any available cookies to be shown in an alert box, when user registration is enabled. In Safari and other web browsers that provide XSS filtering this proof of concept will not work.
Replace “[path to WordPress]” with the location of WordPress.
http://[path to WordPress]/wp-login.php?action=register&redirect_to="><script>alert(document.cookie);</script>