漏洞简介
金和网络是专业信息化服务商,为城市监管部门提供了互联网+监管解决方案,为企事业单位提供组织协同OA系统开发平台,电子政务一体化平台,智慧电商平台等服务。金和OA C6 CostPerApplyDetail.aspx 、CostPerExpendDetail.aspx 接口处存在SQL注入漏洞,攻击者除了可以利用 SQL 注入漏洞获取数据库中的信息(例如,管理员后台密码、站点的用户个人信息)之外,甚至在高权限的情况可向服务器中写入木马,进一步获取服务器系统权限。
影响版本
金和OA C6
fofa语法
app="金和网络-金和OA"
漏洞分析
根据 CostPerApplyDetail.aspx 的源码(与CostPerExpendDetail.aspx 相同),在 bin 目录下查找 JHBase.Web.CostControl.dll 将其进行反编译后找到 CostPerApplyDetail 的处理逻辑
protected void Page_Load(object sender, EventArgs e)
{
if (!((Control) this).Page.IsPostBack)
{
if (this.Request.QueryString["DeptID"] != null)
{
this.strDeptID = this.Request.QueryString["DeptID"].ToString();
((HtmlInputControl) this.hiddenDeptID).Value = this.strDeptID;
this.txtDeptName.Text = this.cc.GetDeptName(this.strDeptID);
}
if (this.Request.QueryString["UserID"] != null)
{
this.strUserID = this.Request.QueryString["UserID"].ToString();
((HtmlInputControl) this.hiddenUserID).Value = this.strUserID;
this.txtUserName.Text = this.cc.GetUserName(this.strUserID);
}
}
this.DataBindData(1, this.page_size, (DataSet) null);
}
GetDeptName
public string GetDeptName(string DeptID)
{
string empty = string.Empty;
DataTable dataTable = this.db.ExecSQLReDataTable($"select DeptName from Department where DeptID = '{DeptID}'");
if (dataTable != null && ((InternalDataCollectionBase) dataTable.Rows).Count > 0)
empty = dataTable.Rows[0]["DeptName"].ToString();
return empty;
}
GetUserName
public string GetUserName(string UserID)
{
string empty = string.Empty;
DataTable dataTable = this.db.ExecSQLReDataTable($"select UserName from Users where UserID = '{UserID}'");
if (dataTable != null && ((InternalDataCollectionBase) dataTable.Rows).Count > 0)
empty = dataTable.Rows[0]["UserName"].ToString();
return empty;
}
参数DeptID、UserID被直接拼接进SQL语句执行,从而造成SQL注入漏洞。
漏洞复现
GET /c6/JHSoft.Web.CostControl/Cost/CostPerApplyDetail.aspx/?DeptID=SQLI_POC HTTP/1.1
Host: jhsoft.mrxn.net


成功延时 4 秒

