漏洞简介
上海孚盟软件有限公司是一家专业的外贸SaaS服务和行业解决方案提供商。其旗下产品孚盟云AjaxProductTemplateList.ashx接口存在SQL注入漏洞,未经身份验证的远程攻击者除了可以利用 SQL注入漏洞获取数据库中的信息(例如,管理员后台密码、站点的用户个人信息)之外,甚至在高权限的情况可向服务器中写入木马,进一步获取服务器系统权限。
影响版本
fofa语法
app="孚盟软件-孚盟云"
漏洞分析
直接看 AjaxProductTemplateList.ashx 对应的dll文件 FumaCRM_BS.NewWeb.dll 里有关 AjaxProductTemplateList 方法的实现如下
string str = context.Request["method"].ToString();
if (!string.op_Equality(str, "LoadAllProductTemplateList"))
{
if (!string.op_Equality(str, "AddNewPrjTemplate"))
{
if (!string.op_Equality(str, "SendMail"))
{
if (!string.op_Equality(str, "DeletePrdTemplate"))
{
if (!string.op_Equality(str, "GetPrdTemplate"))
return;
this.GetPrdTemplate(context);
}
else
this.DeletePrdTemplate(context);
}
else
this.SendMail(context);
}
else
this.AddNewPrjTemplate(context);
}
else
this.LoadAllProductTemplateList(context);
}
当 method=SendMail 时,进入SendMail方法
private void SendMail(HttpContext context)
{
InfoMessage infoMessage = new InfoMessage();
try
{
string Fid = context.Request["fid"] == null ? "" : context.Request["fid"];
string str1 = context.Request["templateId"] == null ? "" : context.Request["templateId"];
string str2 = context.Request["mailTo"] == null ? "" : context.Request["mailTo"];
string empty = string.Empty;
if (!string.IsNullOrWhiteSpace(str2) && str2.IndexOf('@') > 0)
empty = str2.Split(new char[1]{ '@' })[0];
string toName = $"{str2}|{empty}";
DataSet dataSet = this.dbHelper.Query("select ID,Subject,ReportId,AttachFormat,TemplateContent from bpProductTemplate where id= " + str1);
最终可以看到,未经过滤或参数化绑定的参数 templateId 被直接拼接进SQL语句中进行执行,造成SQL注入漏洞。
DeletePrdTemplate 方法存在同样的sql注入漏洞
private void DeletePrdTemplate(HttpContext context)
{
InfoMessage infoMessage = new InfoMessage();
try
{
if (this.dbHelper.ExecuteSql("delete from bpProductTemplate where id = " + (context.Request["templateId"] == null ? "" : context.Request["templateId"])) > 0)
GetPrdTemplate 方法也存在同样的SQL注入漏洞
private void GetPrdTemplate(HttpContext context)
{
InfoMessage infoMessage = new InfoMessage();
try
{
DataSet dataSet = this.dbHelper.Query("select ID,Subject,ReportId,AttachFormat,TemplateContent from bpProductTemplate where id = " + (context.Request["templateId"] == null ? "" : context.Request["templateId"]));
漏洞复现
GET /m/Dingding/Ajax/AjaxProductTemplateList.ashx?method=SendMail&templateId=SQLI_POC HTTP/1.1
Host: fumacrm.mrxn.net

通过报错注入,成功在响应里回显数据库版本信息
method=DeletePrdTemplate与method=GetPrdTemplate亦如此,就不在此赘述了。

