金和OA SelectStation.aspx SQL注入漏洞


漏洞简介

金和网络是专业信息化服务商,为城市监管部门提供了互联网+监管解决方案,为企事业单位提供组织协同OA系统开发平台,电子政务一体化平台,智慧电商平台等服务。金和OA C6 SelectStation.aspx 接口处存在SQL注入漏洞,攻击者除了可以利用 SQL 注入漏洞获取数据库中的信息(例如,管理员后台密码、站点的用户个人信息)之外,甚至在高权限的情况可向服务器中写入木马,进一步获取服务器系统权限。

影响版本

金和OA C6

fofa语法

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

漏洞分析

根据 SelectStation.aspx 的源码,在 bin 目录下查找 JHBase.Web.Appraise.dll 将其进行反编译后找到 SelectStation 的处理逻辑

protected void Page_Load(object sender, EventArgs e)
{
  this.htc = ((CultureInfo) this.Session["culture"]).Name + ".css";
  Localization.SessionCulture((Page) this);
  this.InitText();
  this.Response.Buffer = true;
  this.Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1.0);
  this.Response.Expires = 0;
  this.Response.CacheControl = "no-cache";
  string AppraiseType = "";
  if (this.Request.QueryString["AppraiseType"] != null)
    AppraiseType = this.Request.QueryString["AppraiseType"].ToString();
  if (((Control) this).Page.IsPostBack)
    return;
  this.InitPage(AppraiseType);
}

参数 AppraiseType 被带入InitPage方法

private void InitPage(string AppraiseType)
{
  DataSet stationData = new JHSoft.Appraise.AppraiseSet().GetStationData(AppraiseType);

跟进GetStationData

public DataSet GetStationData(string AppraiseType)
{
  DataSet stationData = this.db.ExecSQLReDataSet($"select StaID,StaName from Station Where DelFlag=0 and StaID not in (select AppraiseStation from appraiseSet where AppraiseType = '{AppraiseType}' and DelFlag=0 and AppraiseStation is not null)  order by StaName Asc  ");
  if (this.db.IsError)
    this.strErrMessage = this.db.ErrorMessage;
  return stationData;
}

至此,就非常明了了,AppraiseType 参数均是被直接拼接进SQL语句中后执行,无任何过滤或校验,导致SQL注入漏洞。

漏洞复现

GET /c6/Jhsoft.Web.Appraise/SelectStation.aspx/?AppraiseType=SQLI_POC HTTP/1.1
Host: jhsoft.mrxn.net

成功延时 5 秒


手机扫码阅读

金和OA SetKPILevelXml.aspx XXE漏洞

金和OA SearchExcerptStation.aspx XXE+SQL注入漏洞

评 论