19 Sep

Our Proactive Monitoring Caught an Authenticated Persistent XSS Vulnerability in a WordPress Plugin with 6,000+ Installs

One of the ways we help to improve the security of WordPress plugins, not just for the customers of our service, but for everyone using them, is our proactive monitoring of changes made to plugins in the Plugin Directory to try to catch serious vulnerabilities. Through that we caught an authenticated persistent cross-site scripting (XSS) vulnerability in the plugin Youtube Showcase (YouTube Gallery). That is a type of vulnerability appears to have been a type that hackers have been looking for undisclosed vulnerabilities to exploit recently, so finding it before them is a very good thing.

The vulnerability is due to multiple security failures, as if often the case. The plugin registers the function emd_insert_new_shc() to be accessible by those logged in to WordPress:


It appears that the user interface connected with that isn’t accessible unless you have a premium version of the plugin, but it appears that it is only intended to be used by Administrators. The function’s code, which handles saving a shortcode for the plugin, though doesn’t include a capabilities check to restrict access:

function emd_insert_new_shc(){
	if(!empty($_GET['app']) && !empty($_GET['shc'])){
		$user_shortcodes = get_option($_GET['app'] . '_user_shortcodes',Array());
		$shc_list = get_option($_GET['app'] . '_shc_list');
		preg_match('/\[(\w*)( filter="(.+)")?\]/',stripslashes($_GET['shc']),$matches);
			$myshc['name'] = $matches[1];
			$myshc['type'] = '';
			if(!empty($myshc['name']) && !empty($shc_list['forms'])){
					$myshc['type'] = __('Form','emd-plugins') . ' - ' . ucfirst($shc_list['forms'][$myshc['name']]['type']);
			if(empty($myshc['type']) && !empty($myshc['name']) && !empty($shc_list['shcs'])){
					$myshc['type'] = __('View','emd-plugins');
			if(empty($myshc['type']) && !empty($myshc['name']) && !empty($shc_list['integrations'])){
					$myshc['type'] = __('View','emd-plugins');
			$myshc['shortcode'] = $_GET['shc'];	
			$myshc['created'] = current_time('timestamp',0);
			$user_shortcodes[] = $myshc;
			update_option($_GET['app'] . '_user_shortcodes',$user_shortcodes);

The code is also missing a nonce check to prevent cross-site request forgery (CSRF) and sanitization to restrict malicious content from being included in what is being saved. As the proof of concept below shows there also isn’t escaping when outputting the saved content on an admin page of WordPress, so there is an authenticated persistent cross-site scripting (XSS) vulnerability. Due to the lack of protection against CSRF, this could also be exploited that way as well.

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 concept will cause an alert box with any available cookies to be shown when visiting the page /wp-admin/admin.php?page=youtube_showcase_shortcodes, when logged in to WordPress.

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

http://[path to WordPress]/wp-admin/admin-ajax.php?action=emd_insert_new_shc&app=youtube_showcase&shc=[a filter="a"]"><script>alert(document.cookie);</script>

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.