某通T+产品漏洞风险排查及代码缺陷评估

0x01 背景

2022年08月28日,各大安全公司监测到很多主机被.locked后缀的勒索病毒加密,通过加密文件特征分析,确认此次勒索病毒为 TellYouThePass 变种。行业监管机构也第一时间通知各家单位高度重视,提醒警惕加强防范,全面排查相关系统资产,及时备份主机重要文件做好安全防护,严防勒索病毒攻击。经过本地搭建复现环境评估发现某通T+产品存在文件上传0day漏洞,且运行环境高权限风险共同导致的勒索事件。.

0x02 缺陷

1.1 另一处文件上传漏洞

由于系统采用了预编译模式,上传的aspx文件不能运行,所以漏洞虽然存在,但基本无实际危害,漏洞位于 /CommonPage/UserFileUpload.aspx,核心代码如下

protected void btUpLoad_ServerClick(object sender, EventArgs e)  {    if (this.myFileUpload.HasFile)    {      this.fileHepler.Path = "UserFiles";      bool flag = this.fileHepler.UpLoadUserFile(this.myFileUpload);      if (flag)      {        AjaxUserFileService.ReadFileInfo(ref this.info, Path.Combine(HttpContext.Current.Server.MapPath("~"), this.fileHepler.Path.TrimEnd(new char[]        {          '\\'        }) + "\\" + this.myFileUpload.FileName));        this.info.FileName = this.myFileUpload.FileName;        this.info.FileType = this.info.FileName.Substring(this.info.FileName.IndexOf("."), this.info.FileName.Length - this.info.FileName.IndexOf("."));        this.info.VoucherName = this.voucherName;        this.info.DtoID = ((this.dtoID == string.Empty) ? Guid.NewGuid() : new Guid(this.dtoID));        try        {          this.info.Creater = ((UserInfo)this.Session["UserInfo"]).UserName;        }        catch        {        }        this.info.CreateTime = DateTime.Now;        this.userfileService.UploadFile(this.info);        this.strRunScript = "top.window.returnValue ='OK';window.close();";        return;      }      this.strRunScript = "alert('" + this.fileHepler.MSG + "!');";    }  }

跟进fileHelper.UpLoadUserFile方法发现未作任何扩展名过滤,直接调用PostFile.SaveAs方法保存文件,这样说明可直接上传任意文件,但是关键是不能跨目录上传,因为在箭头指向的UploadFile.FileName属性获取时,用了System.IO.Path.GetFileName方法,此方法只能获取最后一个/开始后的文件名,所以在HTTP包里构造 Content-Disposition: form-data; name="myFileUpload"; filename="../../../x.aspx" 是行不通的。例如笔者上传了dotnetofbypass.aspx,访问后抛出未编译异常

某通T+产品漏洞风险排查及代码缺陷评估

某通T+产品漏洞风险排查及代码缺陷评估

某通T+产品漏洞风险排查及代码缺陷评估