SugarCRM <= 6.5.23 (SugarRestSerialize.php) PHP Object Injection Vulnerability

http://www.sugarcrm.com

• Affected Versions:

Version 6.5.23 CE and prior versions.

• Vulnerability Description:

The vulnerable code is located in the /service/core/REST/SugarRestSerialize.php script:

67function serve(){
68    $GLOBALS['log']->info('Begin: SugarRestSerialize->serve');
69    $data = !empty($_REQUEST['rest_data'])? $_REQUEST['rest_data']: '';
70    if(empty($_REQUEST['method']) || !method_exists($this->implementation, $_REQUEST['method'])){
71        $er = new SoapError();
72        $er->set_error('invalid_call');
73        $this->fault($er);
74    }else{
75        $method = $_REQUEST['method'];
76        $data = unserialize(from_html($data));
77        if(!is_array($data))$data = array($data);
78        $GLOBALS['log']->info('End: SugarRestSerialize->serve');

User input passed through the “rest_data” request parameter is not properly sanitized before being used in a call to the unserialize() PHP function at line 76. This can be exploited to inject arbitrary PHP objects into the application scope, and could allow unauthenticated attackers to execute arbitrary PHP code via specially crafted serialized objects.

• Proof of Concept:

https://www.exploit-db.com/exploits/40344

• Solution:

Update to version 6.5.24 CE or later to partially mitigate the vulnerability.

NOTE: version 6.5.23 CE includes a fix for this kind of vulnerability. However, the fix is not enough to prevent object injection attacks because the input validation check can be bypassed.

• Disclosure Timeline:

[12/06/2015] – Vendor notified

[09/03/2016] – Version 6.5.23 released along with a security advisory: http://www.sugarcrm.com/security/sugarcrm-sa-2016-001

[13/05/2016] – Vendor notified about the ineffective fix

[17/06/2016] – CVE number requested

[23/06/2016] – Public disclosure

[21/07/2016] – Version 6.5.24 released along with a security advisory: http://www.sugarcrm.com/security/sugarcrm-sa-2016-008

[07/09/2016] – Proof of concept published

• CVE Reference:

The Common Vulnerabilities and Exposures project (cve.mitre.org) has not assigned a CVE identifier for this vulnerability.

• Credits:

Vulnerability discovered by Egidio Romano.