Our Proactive Monitoring Caught a CSRF/PHP Object Injection Vulnerability in Blocksy Companion
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. Through that we caught a cross-site request forgery (CSRF)/PHP object injection vulnerability in the plugin Blocksy Companion.
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 vulnerability exists in function that runs when accessing the plugin’s AJAX function blocksy_customizer_import, which is located in the file /framework/features/customizer-options-manager.php. That function first restricts access to the rest of the code to users with the manage_options capability, so only Administrators can access it, and then unserializes the value of the POST input “data”:
30 31 32 33 34 35 36 37 38 39 | add_action('wp_ajax_blocksy_customizer_import', function () { if (! current_user_can('manage_options')) { wp_send_json_error(); } if (! isset($_POST['data'])) { wp_send_json_error(); } $data = @unserialize(wp_unslash($_POST['data'])); |
Through that unserialization, PHP objection can occur, as can be confirmed with the proof of concept below.
While it wouldn’t be a vulnerability for an Administrator to do that, there is a missing check for a valid nonce, so that can be exploited through CSRF. That CSRF issue would also allow a hacker to cause that import feature to be used for its intended functionality and to cause the other functions located in the same file to be used.
WordPress Causes Full Disclosure
Because 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).
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.
Replace “[path to WordPress]” with the location of WordPress.
<html> <body> <form action="http://[path to WordPress]/wp-admin/admin-ajax.php?action=blocksy_customizer_import" method="POST"> <input type="hidden" name="data" value='O:20:"php_object_injection":0:{}"' /> <input type="submit" value="Submit" /> </form> </body>