金和OA SubjectHandler.ashx SQL注入漏洞


漏洞简介

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

影响版本

金和OA C6

fofa语法

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

漏洞分析

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

public void ProcessRequest(HttpContext context)
{
  string str = string.Empty;
  if (!string.IsNullOrEmpty(this.Action))
  {
    string action;
    str = (action = this.Action) == null || !string.op_Equality(action, "updateactive") ? "{\"result\":false}" : str + this.UpdateActive();
  }
  context.Response.ContentType = "application/json";
  context.Response.Write(str);
  context.Response.Expires = 0;
  context.Response.Buffer = true;
  context.Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1.0);
  context.Response.AddHeader("pragma", "no-cache");
  context.Response.CacheControl = "no-cache";
}

private string UpdateActive()
{
  string empty = string.Empty;
  return this.Budget_Subject.UpdateActive(this.SubjectCode, this.IsActive) <= 0 ? "{\"result\":false}" : "{\"result\":true}";
}

当 Action=updateactive 时,SubjectCode、IsActive 被带入UpdateActive方法

public int UpdateActive(string subjectCode, int IsActive)
{
  StringBuilder stringBuilder = new StringBuilder();
  if (IsActive == 0)
  {
    stringBuilder.Append("update Budget_Subject set IsActive=" + (object) IsActive);
    stringBuilder.Append($" where SubjectCode='{subjectCode}' or ParentID='{subjectCode}'");
    return this.dblib.ExecSQLReInt(stringBuilder.ToString());
  }
  stringBuilder.Append("update Budget_Subject set IsActive=" + (object) IsActive);
  stringBuilder.Append($" where SubjectCode='{subjectCode}'");
  return this.dblib.ExecSQLReInt(stringBuilder.ToString());
}

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

漏洞复现

GET /c6/JHSoft.Web.CostControl/subClass/Handlers/SubjectHandler.ashx?SubjectCode=SQLI_POC&Action=updateactive HTTP/1.1
Host: jhsoft.mrxn.net

成功延时 4 秒


手机扫码阅读

天锐绿盾审批系统 /ext/app/fileopen/record、list fastjson反序列化漏洞

天锐绿盾审批系统 /ext/findUserTrustees、findTrusteesByUser、countUnread、updateToRead、findTrusteeBydeptId、findTrusteeByFilter fastjson反序列化漏洞

评 论