5 Sep 2019

Our Proactive Monitoring Caught an Arbitrary File Viewing Vulnerability in Groundhogg

One of the ways we help to improve the security of WordPress plugins, not just for the 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. Due to recent improvements to that we caught an arbitrary file viewing vulnerability, which is a type of vulnerability likely to be exploited, in the plugin Groundhogg.

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. That tool flags the possibility of other issues in this plugin as well.

This isn’t the first time this monitoring has caught an issue in this plugin, so if you are using it or considering using it we would recommend you make sure it has gotten a thorough security review done.

In the file /includes/rewrites.php the function template_redirect() is registered to run during template_redirect:

15
add_action( 'template_redirect', [ $this, 'template_redirect' ] );

So it will run when accessing the frontend of the website.

The first part of that code will cause different code to run based on the of the “subpage” input:

174
175
176
177
178
179
180
181
182
183
184
public function template_redirect( $template='' )
{
 
	if ( ! is_managed_page() ){
		return;
	}
 
	$subpage = get_query_var( 'subpage' );
	$template_loader = $this->get_template_loader();
 
	switch ( $subpage ){

With that set to “files” the following code will run that will download a specified file from the “file_path” input:

237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
		case 'files':
			$file_path = get_query_var( 'file_path' );
 
			if ( ! $file_path || ! file_exists( $file_path ) ){
				return;
			}
 
			$content_type = sprintf( "Content-Type: %s", mime_content_type( $file_path ) );
			$content_size = sprintf( "Content-Length: %s", filesize( $file_path ) );
 
			header( $content_type );
			header( $content_size );
 
			if ( get_request_var( 'download' ) ){
				$content_disposition = sprintf( "Content-disposition: attachment; filename=%s", basename( $file_path ) );
				header( $content_disposition );
			}
 
			status_header( 200 );
			nocache_headers();
 
			readfile( $file_path );
			exit();
			break;

Due to code the function parse_query() the value “file_path” needs to be base64 encoded as it will be base64 decoded:

123
124
$this->map_query_var( $query, 'file_path', 'urldecode' );
$this->map_query_var( $query, 'file_path', 'base64_decode' );

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 show the contents of the WordPress configuration file.

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

http://[path to WordPress]/wp-content/plugins/mapsvg-lite-interactive-vector-maps/gm_download.php?file=/wp-config.php

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.