False Report of Vulnerability in IP2Location Country Blocker Leads to Finding Real Vulnerability
Today Packet Storm published a report claiming there is a persistent cross-site scripting (XSS) vulnerability in the plugin IP2Location Country Blocker. The report makes this claim:
An authenticated user is able to inject arbitrary Javascript or HTML code to the “Frontend Settings” interface available in settings page of the plugin (Country Blocker), due to incorrect sanitization of user-supplied data and achieve a Stored Cross-Site Scripting attack against the administrators or the other authenticated users. The plugin versions prior to 2.26.7 are affected by this vulnerability.
The second instruction for its proof of concept, though, requires that the attacker be logged in as an Administrator:
Visit the “Frontend Settings” interface available in settings page of the plugin that is named “Country Blocker”.
As access to that page is limited to those with the manage_options capability:
1849 | add_submenu_page('ip2location-country-blocker', 'Frontend', 'Frontend', 'manage_options', 'ip2location-country-blocker', [$this, 'frontend_page']); |
So that wouldn’t really be a vulnerability.
There still could be a different vulnerability if there were other security issues when changing the plugin’s settings, assuming the other claims made there were true. We checked on that and found that things were properly secured on that front. But we also noticed in the code that handles that there is a reflected cross-site scripting (XSS) vulnerability in the relevant code.
When accessing the mentioned settings page, the function frontend_page() in the file /ip2location-country-blocker.php is run.
In that function, the value of various POST input, including “frontend_ip_blacklist”, is set to a variable without validation or escaping it:
108 | $frontend_ip_blacklist = (isset($_POST['frontend_ip_blacklist'])) ? $_POST['frontend_ip_blacklist'] : get_option('ip2location_country_blocker_frontend_ip_blacklist'); |
That variable is then output without escaping it:
349 | <input type="text" name="frontend_ip_blacklist" id="frontend_ip_blacklist" value="' . $frontend_ip_blacklist . '" class="regular-text ip-address-list" /> |
Which permits reflected cross-site scripting (XSS) to occur, as confirmed with the proof of concept below.
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 any available cookies to be shown in an alert box, when logged in as an Administrator. In Safari and other web browsers that provide XSS filtering, this proof of concept will not work.
Replace “[path to WordPress]” with the location of WordPress.
<html> <body> <form action="http://[path to WordPress]/wp-admin/admin.php?page=ip2location-country-blocker" method="POST"> <input type="hidden" name="frontend_ip_blacklist" value='"><script>alert(document.cookie);</script>' /> <input type="submit" value="Submit" /> </form> </body> </html>