Our Proactive Monitoring Caught an Authenticated Persistent Cross-Site Scripting (XSS) Vulnerability in Yes-co ORES
One of the ways we help to improve the security of WordPress plugins, not just for our 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 settings change vulnerability that leads to an authenticated persistent cross-site scripting (XSS) vulnerability in the plugin Yes-co ORES.
The plugin allows changing its settings through an AJAX accessible function ajaxSetSetting(). That is registered to be accessible to anyone logged in to WordPress:
951 | add_action('wp_ajax_setsetting', array($this, 'ajaxSetSetting')); |
That function, which is located in the file /includes/classes/yog_plugin.php, doesn’t do any security checks beyond restricting what WordPress options (settings) can be changed to ones connected with the plugin:
1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 | public function ajaxSetSetting() { if (!empty($_POST['name']) && in_array($_POST['name'], array('yog_cat_custom', 'yog_objectsinarchief', 'yog_huizenophome', 'yog_javascript_dojo_dont_enqueue', 'yog_noextratexts', 'yog_nochilds_searchresults', 'yog_order', 'yog_sync_disabled', 'yog_media_size', 'yog_google_maps_api_key'))) { // If not value provided, toggle settings if (!isset($_POST['value'])) $value = !(get_option($_POST['name'])); // Otherwise use provided value else $value = $_POST['value']; update_option($_POST['name'], $value); |
There should be a restriction on what WordPress roles are allowed to change the settings, protection against cross-site request forgery (CSRF), and probably some combination of validation and sanitation of the new values of the settings.
If malicious JavaScript code is set to the value of the setting “yog_google_maps_api_key” that is output on the plugin’s settings page without being escaped, which means there is an authenticated persistent cross-site scripting (XSS) vulnerability:
144 | <input type="text" value="<?php echo (get_option('yog_google_maps_api_key') ? get_option('yog_google_maps_api_key') :''); ?>" name="yog_google_maps_api_key" id="yog_google_maps_api_key" /> |
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 accessing the page /wp-admin/options-general.php?page=yesco_OG, when logged in to WordPress.
Make sure to replace “[path to WordPress]” with the location of WordPress.
<html> <body> <form action="http://[path to WordPress]/wp-admin/admin-ajax.php?action=setsetting" method="POST"> <input type="hidden" name="name" value="yog_google_maps_api_key" /> <input type="hidden" name="value" value='"><script>alert(document.cookie);</script>' /> <input type="submit" value="Submit request" /> </form> </body> </html>