金和OA CostReimbursementHandler.ashx SQL注入漏洞


漏洞简介

金和网络是专业信息化服务商,为城市监管部门提供了互联网+监管解决方案,为企事业单位提供组织协同OA系统开发平台,电子政务一体化平台,智慧电商平台等服务。金和OA C6 CostReimbursementHandler.ashx 接口处存在SQL注入漏洞,攻击者除了可以利用 SQL 注入漏洞获取数据库中的信息(例如,管理员后台密码、站点的用户个人信息)之外,甚至在高权限的情况可向服务器中写入木马,进一步获取服务器系统权限。

影响版本

金和OA C6

fofa语法

app="金和网络-金和OA"

漏洞分析

根据 CostReimbursementHandler.ashx 的源码,在 bin 目录下查找 JHBase.Web.CostControl.dll 将其进行反编译后找到 CostReimbursementHandler 的处理逻辑

public void ProcessRequest(HttpContext context)
{
  context.Response.ContentType = "text/plain";
  string str1 = context.Request["action"];
  string str2;
  if (string.IsNullOrEmpty(str1) || (str2 = str1) == null)
    return;
  if (!string.op_Equality(str2, "Reimbursement"))
  {
    if (!string.op_Equality(str2, "YeahChange"))
    {
      if (!string.op_Equality(str2, "ShengChange"))
      {
        if (!string.op_Equality(str2, "YeahChangeAll"))
        {
          if (!string.op_Equality(str2, "StandradForTravel"))
            return;
          this.getStandradForTravel(context);
        }
        else
          this.GetYeahChangeAll(context);
      }
      else
        this.GetSHI(context);
    }
    else
      this.GetPeriod(context);
  }
  else
    this.Reimbursement(context);
}

根据action的值进入不同的处理流程

当 action=YeahChange 时,yeah被带入Get_Budget_PeriodDivertInformation方法

protected void GetPeriod(HttpContext context)
{
  string str1 = string.Empty;
  DataSet divertInformation = this.cm.Get_Budget_PeriodDivertInformation(context.Request["yeah"]);

跟进Get_Budget_PeriodDivertInformation方法

public DataSet Get_Budget_PeriodDivertInformation(string YearPeriod)
{
  return this.GetDS_BySQL($"{" Select Budget_PeriodManage.YearPeriod,Budget_PeriodManage.Period,Budget_PeriodDivert.Status " + " from Budget_PeriodManage " + " Left outer join Budget_PeriodDivert " + " on Budget_PeriodDivert.YearPeriod = Budget_PeriodManage.YearPeriod " + " and  Budget_PeriodDivert.Period = Budget_PeriodManage.Period "} where Budget_PeriodDivert.Status is null and Budget_PeriodManage.YearPeriod ='{YearPeriod}'" + " order by YearPeriod asc ,Period asc " + "   select Period from Budget_PeriodManage where getdate() between begindate and enddate ");
}

参数yeah被直接拼接到SQL语句中执行,造成SQL注入漏洞。

其他几个方法,也存在同样的sql注入

GetSHI

GetYeahChangeAll

getStandradForTravel

漏洞复现

POST /c6/JHSoft.Web.CostControl/CostManagement/Reimbursement/CostReimbursementHandler.ashx HTTP/1.1
Host: jhsoft.mrxn.net
Content-Type: application/x-www-form-urlencoded

action=YeahChange&yeah=SQLI_POC

成功延时 4 秒


手机扫码阅读

金和OA AjaxForBudgetDecompose.ashx SQL注入漏洞

天锐绿盾审批系统 /conf/editConfigVal fastjson反序列化漏洞

评 论