8 Jul 2021

Authenticated Persistent Cross-Site Scripting (XSS) in Ultimate Responsive Image Slider

The changelog for the latest version of the plugin Ultimate Responsive Image Slider is:

Security issue fixed

Looking at the changes made in that version, we found that there were a variety of security improvements made (and some security changes that didn’t actually improve security). But, for the third day in a row, while looking in to the possibility that a plugin fixed a vulnerability we found that it still contains a vulnerability and one more that looks to be more serious than the issues that were already resolved.

Despite the plugin having 50,000+ installations according to wordpress.org, it doesn’t appear to have had a security review, at least of the type we do, as the issue would have been caught by our review process.

Authenticated Persistent XSS

The plugin creates a new post type used by its sliders and WordPress users with the post capability have the ability to create those:

201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
$args = array(
	'labels' => $labels,
	'hierarchical' => false,
	'supports' => array( 'title'),
	'public' => false,
	'show_ui' => true,
	'show_in_menu' => true,
	'menu_position' => 10,
	'menu_icon' => 'dashicons-format-gallery',
	'show_in_nav_menus' => false,
	'publicly_queryable' => false,
	'exclude_from_search' => true,
	'has_archive' => true,
	'query_var' => true,
	'can_export' => true,
	'rewrite' => false,
	'capability_type' => 'post'
);
 
register_post_type( 'ris_gallery', $args );

What we found was that even with the new version of the plugin, JavaScript code could be saved through at least one setting, Slider Width, on that and it will be shown when visiting the editing page for the slider (and possibly elsewhere). For users without the unfiltered_html capability they should not be able to do that and that would be an authenticated persistent cross-site scripting (XSS) vulnerability.

There underlying code at issue there is in the function ris_settings_meta_save(), which is located in the file /ultimate-responsive-image-slider.php. The problem there is that developer is using the function sanitize_option to, it appears, sanitize the value of many settings:

606
607
608
609
610
611
612
613
614
615
616
617
public function ris_settings_meta_save($PostID) {
	if(isset($PostID) && isset($_POST['wl_action']) == "wl-save-settings") {
		$WRIS_L3_Slide_Title				=	sanitize_option ( 'title', $_POST['wl-l3-slide-title'] );
		$WRIS_L3_Show_Slide_Title			=	sanitize_option ( 'show_title', $_POST['wl-l3-show-slide-title'] );
		$WRIS_L3_Show_Slide_Desc			=	sanitize_option ( 'show_title', $_POST['wl-l3-show-slide-desc'] );
		$WRIS_L3_Auto_Slideshow				=	sanitize_option ( 'autoplay', $_POST['wl-l3-auto-slide'] );
		$WRIS_L3_Transition					=	sanitize_option ( 'transition', $_POST['wl-l3-transition'] );
		$WRIS_L3_Transition_Speed			=	sanitize_text_field( $_POST['wl-l3-transition-speed'] );
		$WRIS_L3_Sliding_Arrow				=	sanitize_option ( 'arrow', $_POST['wl-l3-sliding-arrow'] );
		$WRIS_L3_Slider_Navigation			=	sanitize_option ( 'navigation', $_POST['wl-l3-navigation'] );
		$WRIS_L3_Navigation_Button			=	sanitize_option ( 'navigation_button', $_POST['wl-l3-navigation-button'] );
		$WRIS_L3_Slider_Width				=	sanitize_option ( 'slider_width', $_POST['wl-l3-slider-width'] );

The problem with that is that function will only do any sanitization if the option name, the first value passed to the function, is one handled by the function or you have added an additional filter for it. That isn’t the case with the relevant setting or, it looks like, other ones in that code.

When the setting value is output on the editing page it isn’t escaped either:

475
<input type="text" name="wl-l3-slider-width" id="wl-l3-slider-width" value="<?php echo $WRIS_L3_Slider_Width; ?>">

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

While logged in as a WordPress user with the contributor role, set the custom width of Slider Width of a slider to:

“><script>alert(document.coookie);</script>

When visiting the editing page for that slider, 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.

Leave a Reply

Your email address will not be published.