SugarCRM <= 6.5.18 Two PHP Code Injection Vulnerabilities

• Software Link:

• Affected Versions:

Version 6.5.18 CE and prior versions.

• Vulnerabilities Description:

1) The vulnerable code is located in the /include/utils/array_utils.php script:

function override_value_to_string_recursive2($array_name, $value_name, $value, $save_empty = true) {
	if (is_array($value)) {
		$str = '';
		$newArrayName = $array_name . "['$value_name']";
		foreach($value as $key=>$val) {
			$str.= override_value_to_string_recursive2($newArrayName, $key, $val, $save_empty);
		return $str;
	} else {
		if(!$save_empty && empty($value)){
			return "\$$array_name" . "['$value_name'] = " . var_export($value, true) . ";\n";

The “override_value_to_string_recursive2()” function is being used to save an array into a configuration file with a .php extension. However, this function does not properly escape key names, and this can be exploited to inject and execute arbitrary PHP code through e.g. the following URL, which will write arbitrary PHP code into the config_override.php file:


2) The vulnerable code is located in the /modules/UpgradeWizard/upload.php script:

		    $manifest_file = extractManifest($tempFile);

			if(is_file($manifest_file)) {
	    		require_once( $manifest_file );

The vulnerability is caused by the Upgrade Wizard module, which allows to upload a package with an arbitrary manifest.php file that will be executed by the application. This can be exploited by authenticated administrator users to upload and execute arbitrary PHP code.

• Solution:

Update to version 6.5.19 CE or higher to mitigate the first vulnerability.
No official solution is currently available for the second vulnerability.

• Disclosure Timeline:

[29/10/2014] – Vendor notified
[15/12/2014] – Version 6.5.19 CE released:
[29/04/2015] – CVE number requested
[23/06/2016] – Public disclosure

• CVE Reference:

The Common Vulnerabilities and Exposures project (
has not yet assigned a CVE identifier for these vulnerabilities.

• Credits:

Vulnerabilities discovered by Egidio Romano.