漏洞简介
金和网络是专业信息化服务商,为城市监管部门提供了互联网+监管解决方案,为企事业单位提供组织协同OA系统开发平台,电子政务一体化平台,智慧电商平台等服务。金和OA C6 OpenGroupOpen.aspx 接口处存在SQL注入漏洞,攻击者除了可以利用SQL注入漏洞获取数据库中的信息(例如,管理员后台密码、站点的用户个人信息)之外,甚至在高权限的情况可向服务器中写入木马,进一步获取服务器系统权限。
影响版本
金和OA C6
fofa语法
app="金和网络-金和OA"
漏洞分析
根据 OpenGroupOpen.aspx 的源码,在 bin 目录下查找 JHBase.Web.AddMenu.dll 将其进行反编译后找到 OpenGroupOpen 的处理逻辑
protected void Page_Load(object sender, EventArgs e)
{
this.InitTxt();
if (this.IsPostBack)
return;
if (this.Request.Params["GroupID"] != null)
((HtmlInputControl) this.hidGroupID).Value = this.Request.Params["GroupID"];
string str;
if (this.Request.Params["op"] == null || (str = this.Request.Params["op"]) == null)
return;
if (!string.op_Equality(str, "set"))
{
if (!string.op_Equality(str, "view"))
return;
this.InitGridView();
((Control) this.btnOK).Visible = false;
this.strTitle = "公开组公开范围状态查看";
}
else
{
((Control) this.btnOK).Visible = true;
this.strTitle = "公开组公开范围设置";
this.InitGridSet();
}
}
当 GroupID 参数存在不等于 null 且 op=view 时,进入 InitGridView 方法
private void InitGridView()
{
string str1 = "<root>{0}</root>";
string str2 = "";
int num = 0;
string str3 = $"<record><SystemName ColumnName='{this.strSystemName}' Width='1.0'><![CDATA[{{0}}]]></SystemName><Flag ColumnName='成功标识'>{{1}}</Flag></record>";
DataTable systemTableByGroupId = new OpenGroup().GetGroupOpenSystemTableByGroupID(((HtmlInputControl) this.hidGroupID).Value);
跟进 GetGroupOpenSystemTableByGroupID 方法
public DataTable GetGroupOpenSystemTableByGroupID(string GroupID)
{
GroupID = GroupID.Replace(",", "','");
string str = $"select a.*, b.System_ID, b.System_Name from outerreceipt a inner join OuterSystem b on a.ToSystemID = b.System_ID where moduletype='opengroups' and deleteFlag=0 and a.recordid in ('{GroupID}')";
return DBOperatorFactory.GetDBOperator().ExecSQLReDataTable(str);
}
至此,就非常明了了,参数 GroupID 被直接拼接进SQL语句中后执行,无任何过滤或校验,导致SQL注入漏洞。
漏洞复现
GET /c6/Jhsoft.Web.AddMenu/OpenGroupOpen.aspx/?GroupID=SQLI_POC&op=view HTTP/1.1
Host: jhsoft.mrxn.net

成功延时 5 秒

