------------------------------------------------------------------------ CMS Commander Client WordPress Plugin unauthenticated PHP Object injection vulnerability ------------------------------------------------------------------------ Yorick Koster, June 2016 ------------------------------------------------------------------------ Abstract ------------------------------------------------------------------------ A PHP Object injection vulnerability was found in the CMS Commander Client WordPress Plugin, which can be used by an unauthenticated user to instantiate arbitrary PHP Objects. Using this vulnerability it is possible to execute arbitrary PHP code. ------------------------------------------------------------------------ OVE ID ------------------------------------------------------------------------ OVE-20160803-0003 ------------------------------------------------------------------------ Tested versions ------------------------------------------------------------------------ This issue was successfully tested on the CMS Commander Client [2] WordPress Plugin version 2.21. ------------------------------------------------------------------------ Fix ------------------------------------------------------------------------ Input validation was added to version 2.22 [3] of CMS Commander Client to mitigate this issue. ------------------------------------------------------------------------ Introduction ------------------------------------------------------------------------ The CMS Commander Client [2] WordPress Plugin can manage multiple WordPress sites from a single dashboard. A PHP Object injection [4] vulnerability was found in the CMS Commander Client WordPress Plugin, which can be used by an unauthenticated user to instantiate arbitrary PHP Objects. ------------------------------------------------------------------------ Details ------------------------------------------------------------------------ This issue is possible due to an unsafe call to unserialize() in the cmsc_authenticate() method. The input is taken directly from the POST body as can be seen in the following code fragment: functions.php: if( !function_exists('cmsc_authenticate')) { function cmsc_authenticate() { global $_cmsc_data, $_cmsc_auth, $cmsc_core; if (!isset($HTTP_RAW_POST_DATA)) { $HTTP_RAW_POST_DATA = file_get_contents('php://input'); } /*if(substr($HTTP_RAW_POST_DATA, 0, 7) == "action="){ $HTTP_RAW_POST_DATA = str_replace("action=", "", $HTTP_RAW_POST_DATA); }*/ $_cmsc_data = base64_decode($HTTP_RAW_POST_DATA); if (!$_cmsc_data){ return; } $_cmsc_data = cmsc_parse_data( @unserialize($_cmsc_data) ); It has been confirmed that this issues can be used to execute arbitrary PHP code. ------------------------------------------------------------------------ References ------------------------------------------------------------------------ [1] https://sumofpwn.nl/advisory/2016/cms_commander_client_wordpress_plugin_unauthenticated_php_object_injection_vulnerability.html [2] https://wordpress.org/plugins/cms-commander-client/ [3] https://downloads.wordpress.org/plugin/cms-commander-client.2.22.zip [4] https://www.owasp.org/index.php/PHP_Object_Injection