Vtiger CRM SQL注入漏洞

QQ空间 新浪微博 微信 QQ facebook twitter
漏洞ID 1166755 漏洞类型 SQL注入
发布时间 2013-08-01 更新时间 2013-08-01
CVE编号 CVE-2013-3213 CNNVD-ID CNNVD-201308-014
漏洞平台 N/A CVSS评分 7.5
|漏洞来源
https://www.securityfocus.com/bid/61563
https://cxsecurity.com/issue/WLB-2013080018
http://www.cnnvd.org.cn/web/xxk/ldxqById.tag?CNNVD=CNNVD-201308-014
|漏洞详情
VtigerCRM是美国Vtiger公司的一套基于SugarCRM开发的客户关系管理系统(CRM)。该管理系统提供管理、收集、分析客户信息等功能。vTigerCRM5.0.0至5.4.0版本中存在SQL注入漏洞,该漏洞源于soap/customerportal.php脚本没有正确过滤get_picklists方法中的‘picklist_name’参数;soap/customerportal.php脚本没有正确过滤get_tickets_list方法中的‘where’参数;soap/vtigerolservice.php脚本没有正确过滤SearchContactsByEmail方法中的‘emailaddress’参数;soap/thunderbirdplugin.php脚本没有正确过滤SearchContactsByEmail方法中的‘emailaddress’参数。远程攻击者可利用该漏洞执行任意SQL命令。
|漏洞EXP
--------------------------------------------------------------------------
vtiger CRM <= 5.4.0 (SOAP Services) Multiple SQL Injection Vulnerabilities
--------------------------------------------------------------------------


[-] Software Link:

http://www.vtiger.com/


[-] Affected Versions:

All versions from 5.0.0 to 5.4.0.


[-] Vulnerability Description:

1) The vulnerable code is located in the get_picklists SOAP method defined in /soap/customerportal.php:

1177. 	$id = $input_array['id'];
1178. 	$sessionid = $input_array['sessionid'];
1179. 	$picklist_name = $adb->sql_escape_string($input_array['picklist_name']);
1180.
1181. 	if(!validateSession($id,$sessionid))
1182. 	return null;
1183.
1184. 	$picklist_array = Array();
1185.
1186. 	$admin_role = 'H2';
1187. 	$userid = getPortalUserid();
1188. 	$roleres = $adb->pquery("SELECT roleid from vtiger_user2role where userid = ?", array($userid));
1189. 	$RowCount = $adb->num_rows($roleres);
1190. 	if($RowCount > 0){
1191. 		$admin_role = $adb->query_result($roleres,0,'roleid');
1192. 	}
1193.
1194. 	$res = $adb->pquery("select vtiger_". $picklist_name.".* from vtiger_". $picklist_name." inner join [...]

User input passed through the "picklist_name" parameter seems to be correctly sanitised by the
sql_escape_string() method, but the vulnerability exists because it's used in the query at line 1194
without single or double quotes. This can be exploited to conduct blind SQL injection attacks.

2) The vulnerable code is located in the get_tickets_list SOAP method defined in /soap/customerportal.php:

654. 	$id = $input_array['id'];
655. 	$only_mine = $input_array['onlymine'];
656. 	$where = $input_array['where']; //addslashes is already added with where condition fields in portal itself
657. 	$match = $input_array['match'];
658. 	$sessionid = $input_array['sessionid'];
659.
660. 	if(!validateSession($id,$sessionid))
661. 		return null;
662.
663. 	// Prepare where conditions based on search query
664. 	$join_type = '';
665. 	$where_conditions = '';
666. 	if(trim($where) != '') {
667. 		if($match == 'all' || $match == '') {
668. 			$join_type = " AND ";
669. 		} elseif($match == 'any') {
670. 			$join_type = " OR ";
671. 		}
672. 		$where = explode("&&&",$where);
673. 		$where_conditions = implode($join_type, $where);

[...]

707. 	$query = "SELECT vtiger_troubletickets.*, vtiger_crmentity.smownerid,vtiger_crmentity.createdtime, [...]
708. 		FROM vtiger_troubletickets
709. 		INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_troubletickets.ticketid AND [...]
710. 		WHERE vtiger_troubletickets.parent_id IN (". generateQuestionMarks($entity_ids_list) .")";
711. 	// Add conditions if there are any search parameters
712. 	if ($join_type != '' && $where_conditions != '') {
713. 		$query .= " AND (".$where_conditions.")";
714. 	}

User input passed through the "where" parameter isn't properly validated before being
used in a SQL query at line 713. This can be exploited to conduct SQL injection attacks.

3) The vulnerable code is located in the SearchContactsByEmail SOAP method defined in /soap/thunderbirdplugin.php:

186.	function SearchContactsByEmail($username,$password,$emailaddress)
187.	{
188.	  if(authentication($username,$password))
189.	  {
190.	     require_once('modules/Contacts/Contacts.php');
191.	
192.	     $seed_contact = new Contacts();
193.	     $output_list = Array();
194.	
195.	     $response = $seed_contact->get_searchbyemailid($username,$emailaddress);

User input passed through the "emailaddress" parameter isn't properly validated before being used
in a call to the Contacts::get_searchbyemailid() method at line 195. This can be exploited to conduct
SQL injection attacks. Successful exploitation of this vulnerability requires authentication.

4) The vulnerable code is located in the SearchContactsByEmail SOAP method defined in /soap/vtigerolservice.php:

282.	function SearchContactsByEmail($username,$session,$emailaddress)
283.	{
284.		if(!validateSession($username,$session))
285.		return null;
286.		require_once('modules/Contacts/Contacts.php');
287.	
288.	     $seed_contact = new Contacts();
289.	     $output_list = Array();
290.	
291.	     $response = $seed_contact->get_searchbyemailid($username,$emailaddress);

User input passed through the "emailaddress" parameter isn't properly validated before being used in
a call to the Contacts::get_searchbyemailid() method at line 291. This can be exploited to conduct SQL
injection attacks. Successful exploitation of this vulnerability requires knowledge of a valid username.


[-] Solution:

Apply the vendor patch:http://www.vtiger.com/blogs/?p=1467


[-] Disclosure Timeline:

[13/01/2013] - Vendor notified
[06/02/2013] - Vendor asked feedback abouthttp://trac.vtiger.com/cgi-bin/trac.cgi/changeset/13848
[05/03/2013] - Feedback provided to the vendor
[26/03/2013] - Vendor patch released
[18/04/2013] - CVE number requested
[20/04/2013] - CVE number assigned
[01/08/2013] - Public disclosure


[-] CVE Reference:

The Common Vulnerabilities and Exposures project (cve.mitre.org)
has assigned the name CVE-2013-3213 to these vulnerabilities.


[-] Credits:

Vulnerabilities discovered by Egidio Romano.


[-] Original Advisory:

http://karmainsecurity.com/KIS-2013-06

|受影响的产品
vtiger vtiger CRM 5.3 vtiger vtiger CRM 5.2.1 vtiger vtiger CRM 5.2 vtiger vtiger CRM 5.1 vtiger vtiger CRM 5.0.4 vtiger vtiger CRM 5.0.3 vtiger vtiger C
|参考资料

来源:www.vtiger.com
链接:https://www.vtiger.com/blogs/?p=1467
来源:XF
名称:vtigercrm-cve20133213-multiple-sql-injection(86129)
链接:http://xforce.iss.net/xforce/xfdb/86129
来源:BID
名称:61563
链接:http://www.securityfocus.com/bid/61563
来源:karmainsecurity.com
链接:http://karmainsecurity.com/KIS-2013-06
来源:BUGTRAQ
名称:20130801[KIS-2013-06]vtigerCRM<=5.4.0(SOAPServices)MultipleSQLInjectionVulnerabilities
链接:http://archives.neohapsis.com/archives/bugtraq/2013-08/0001.html