Information Disclosure Vulnerability in Pike Firewall
In our testing of WordPress security plugins to see what, if any, protection they provide against the exploitation of actual vulnerabilities in other plugins the results haven’t been good so far. Most of the plugins tested haven’t provided any protection against those vulnerabilities. That hasn’t really surprised us, as much of what these plugins do doesn’t have any impact on what hackers actually try to do. One example is that many of these plugins check if you have change the database prefix to something other than the default “wp_”, but knowing the database prefix is rarely needed for vulnerabilities we see being exploited. If knowing the database prefix was a big deal then the vulnerability we recently found in a security plugin would be a big deal, as the vulnerability exposes that.
While doing a few quick security checks over the plugin Pike Firewall we noticed that it has the capability to log login attempts. We and others have found that capability in plugins has introduced security vulnerabilities into plugins due to improper handling of user input that comes through that. One of things that has been an issue with other plugins is that malicious JavaScript code placed in the HTTP header field X-Forwarded-For will get displayed on the plugin’s pages unsanitized or unescaped leading to cross-site scripting (XSS). In this case we found it caused another issue when tried logging in with it set to malicious code we got this error:
WordPress database error: []
SHOW FULL COLUMNS FROM `wp_pike_firewall_login`
The database prefix is being shown in that error message.
In looking at the underling code the cause of this is (in the file /pikefirewall.php):
2756 2757 2758 2759 | if ( !$wpdb->insert($pike_tables['login'], array('username' => $username, 'user_address' =>; $pike_ip, 'user_agent' => $pike_agent, 'type' => $type, 'success' => $success), array('%s', '%s', '%s'))) { $wpdb>show_errors(); wp_die($wpdb->print_error()); } |
You can see that error reporting is enabled and if there is an error it gets printed, which shouldn’t be happening in a non-development environment since as our example shows it is disclosing non-public information.
We contacted the developer about the issue on December 19, but we have not heard back from them and the vulnerability has not been fixed.
Proof of Concept
With login attempt logging turned on, set the X-Forwarded-For HTTP header to
<script>alert(document.cookie);</script>
and attempt to log in to WordPress (the username/password doesn’t matter).
Timeline
- December 19, 2016 – Developer notified.