12 Aug

Settings Change Vulnerability in Instagram Feed by 10Web (10Web Social Feed for Instagram)

The plugin Instagram Feed by 10Web (10Web Social Feed for Instagram) was closed on the WordPress Plugin Directory on Friday. That is one of the 1,000 most popular plugins with 80,000+ installs, so we were alerted to its closure. While we were looking in to the plugin to see if there were any serious vulnerabilities we should be warning users of the plugin that also use our service, we found that it contains a less serious one related to a more serious one, a settings change vulnerability. There also look to be other security issues as well, which isn’t surprising considering the developer of that plugin has a long history of not handling security properly.

In the plugin’s main file this code runs when the plugin is loaded:

53
54
55
if(!empty($_GET['wdi_code'])) {
  add_action('plugins_loaded', 'wdi_save_user_access_token');
}

That will cause the function wdi_save_user_access_token() to run after plugins have loaded if the GET input “wdi_code” is not empty.

That function will save a plugin setting based on user input without any security checks first:

57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
function wdi_save_user_access_token(){
  $options = wdi_get_options();
 
  $token = $_GET['wdi_code'];
 
  $accounts = null;
  $url = "https://graph.facebook.com/me/accounts?fields=instagram_business_account&limit=500&access_token=" . $token;
  $request = wp_remote_get($url);
  if (!is_wp_error($request) || wp_remote_retrieve_response_code($request) === 200) {
    $body = $request['body'];
    $accounts = json_decode($body, true);
  }
 
  if(!is_array($accounts)) {
    //invalid access token
    add_action('admin_notices', 'wdi_invalid_fb_token_notice');
    return;
  }
 
  $business_accounts = array();
 
  foreach($accounts['data'] as $accounts_data) {
 
    foreach($accounts_data as $key => $data) {
      if($key === "instagram_business_account") {
        $business_accounts[] = $data['id'];
      }
    }
 
  }
 
  if(empty($business_accounts)) {
    //no business accounts
    add_action('admin_notices', 'wdi_no_business_account_notice');
    return;
  }
 
  $key = array_rand($business_accounts, 1);
 
  $options['fb_token'] = $token;
  $options['business_account_id'] = $business_accounts[$key];
  update_option(WDI_OPT, $options);

It looks like there should be a capabilities check to limit who has access to that and nonce check to prevent cross-site request forgery (CSRF). Sanitizing and or validating the user input would be better as well.

A valid access token for an Instagram Business Account is needed for the value to be saved, which may limit the placing of anything malicious in the setting.

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 update the access token.

Make sure to replace “[path to WordPress]” with the location of WordPress and “[access token]” with an Instagram Business Account token.

http://[path to WordPress]/?wdi_code=[access token]

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.