26 Jul 2019

Authenticated Persistent Cross-Site Scripting (XSS) Vulnerability in Facebook Widget (Widget for Facebook Page Feeds)

The plugin Facebook Widget (Widget for Facebook Page Feeds) was closed on the WordPress Plugin Directory yesterday. That is one of the 1,000 most popular plugins, so we were alerted to its closure. While we were looking in to the plugin to see if there were any vulnerabilities we should be warning users of the plugin that also use our service, we found that it contains an authenticated persistent cross-site scripting (XSS) vulnerability due to not properly handling the security of shortcode attributes.

The plugins shortcode “fb_widget” causes the function fb_plugin_shortcode() to run. That function is located in the file /short_code.php:

2
3
4
5
6
7
8
9
10
11
function fb_plugin_shortcode($atts) {
	$defaults = shortcode_atts(array('title' => 'Like Us On Facebook', 'app_id' => '503595753002055', 'fb_url' => 'http://facebook.com/WordPress', 'width' => '400', 'height' => '500', 'data_small_header' => 'false', 'select_lng' => 'en_US', 'data_small_header' => 'false', 'data_adapt_container_width' => 'false', 'data_hide_cover' => 'false', 'data_show_facepile' => 'true', 'data_show_posts' => 'true', 'custom_css' => '', 'data_tabs' => 'timeline'), $atts);
	wp_register_script('milapfbwidgetscript', FB_WIDGET_PLUGIN_URL . 'fb.js', array('jquery'));
	wp_enqueue_script('milapfbwidgetscript');
	$local_variables = array('app_id' => $defaults['app_id'], 'select_lng' => $defaults['select_lng']);
	wp_localize_script('milapfbwidgetscript', 'milapfbwidgetvars', $local_variables);
	return '<div class="fb_loader" style="text-align: center !important;"><img src="' . plugins_url() . '/facebook-pagelike-widget/loader.gif" /></div>
	<div id="fb-root"></div>
	<div class="fb-page" data-href="' . $defaults['fb_url'] . '" data-width="' . $defaults['width'] . '" data-height="' . $defaults['height'] . '" data-small-header="' . $defaults['data_small_header'] . '" data-adapt-container-width="' . $defaults['data_adapt_container_width'] . '" data-hide-cover="' . $defaults['data_hide_cover'] . '" data-show-facepile="' . $defaults['data_show_facepile'] . '" data-show-posts="' . $defaults['data_show_posts'] . '" style="' . $defaults['custom_css'] . '" data-tabs="'. $defaults['data_tabs'] .'"></div>';
}

The first line of code in that function sets attributes from a shortcode to the variable $defaults without sanitizing the input. For lower level users, WordPress will have already do some sanitization of them, but does not sanitize them for usage as HTML tag attributes. On the last line a number of those are output as HTML tag attributes without being escaped. As the proof of concept below confirms that could be abused to cause malicious JavaScript code to be included on the page, otherwise known as an authenticated persistent cross-site scripting (XSS) vulnerability.

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

When logged in as an Author, which does not have the unfiltered_html capability, place the following shortcode on a post:

[fb_widget height='" onmouseover="alert(document.cookie)']

When visiting the post on the frontend, when hovering over the facebook widget an alert box with any available cookies will be shown.


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.

Need Continued Support for a Closed Plugin?

Does your website depend on a WordPress plugin that is no longer being supported by the original developer? With our Abandoned WordPress Plugin Maintenance Service, we can maintain the plugin for you, so you can safely use the plugin going forward.

Plugin Security Scorecard Grade for Facebook Widget

Checked on October 6, 2024
C+

See issues causing the plugin to get less than A+ grade

2 thoughts on “Authenticated Persistent Cross-Site Scripting (XSS) Vulnerability in Facebook Widget (Widget for Facebook Page Feeds)

  1. Hello,

    I am an author of “Widget for Social Page Feeds” plugin. I have fixed Authenticated Persistent Cross-Site Scripting (XSS) Vulnerability with shortcode and updated to plugin version 5.1.

    Can you please test it again and let me know if everything is fine?

    • Our suggested way to find out if a vulnerabilities in plugins someone is using have been fixed is explained under the Is It Fixed? heading in our post.

Leave a Reply to Milap Cancel reply

Your email address will not be published.