29 Aug 2017

PHP Object Injection Vulnerability in WP Smart Security

When it comes to advice on improving the security of a WordPress websites the recommendation is often to install some security plugin. We have yet to see this advice paired with evidence that the security plugin in question is effective at providing protection. In our testing of them to see if security plugins can protect against real vulnerabilities in other plugins, which seems to be about the only testing ever done, the results haven’t been good. Having a false sense of security isn’t good, since it may lead to failing doing things that will actually protect a website, but using security plugins can have a much worse consequence, it can lead to your website being hacked.

We recently have been going through some data on possible PHP object injection vulnerabilities in WordPress plugins and one of the reports from that indicated the possibility of that type of vulnerability in the security plugin WP Smart Security. A quick check confirmed that there was in fact that type of vulnerability in this plugin. That type of vulnerability has been exploited on fairly wide-scale in the last year, so using this plugin could open the website using it to being hacked.

When the plugin is active it creates a new instance of the class bitset_wpspro when any WordPress page loads. That in turn will create a new instance of the class wpspro_secure, which runs the following code when it is constructed (in the file /inc/secure.php):

16
17
18
19
20
$HTTP_RAW_POST_DATA = file_get_contents( 'php://input' );
$data = base64_decode( $HTTP_RAW_POST_DATA );
 
if ( $data ) {
	$unserialized_data = @maybe_unserialize( $data );

That code will take the raw post data sent with the request, base64_decode() it, and then possibly unserialize() it. The unserialization of user input opens it up to PHP objection injection.

We contacted the developer a week ago and have not heard back from them. The plugin has never been updated since it was released 18 months ago, not even to note that it is compatible with newer version of WordPress, so it doesn’t appear to be being actively supported.

Proof of Concept

With our plugin for testing for PHP object injection installed and activated, send a request to a page on the website with raw POST data set to “TzoyMDoicGhwX29iamVjdF9pbmplY3Rpb24iOjA6e30=” and  the message “PHP object injection has occurred.” will be shown.

Timeline

  • August 22, 2017 – Developer notified.

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. Required fields are marked *