SQL注入——类型及提交方法
SQL注入——类型及提交方法
1.前言
在现实的SQL注入安全测试中,我们首先要明确提交数据及提交方法后再进行相关的注入,其中提交数据类型和提交方法可以通过抓包分析获取,后续的安全测试中我们也必须满足同等的操作才能进行注入。

2.数据类型
- 数字型语句:
1 |
|
- 字符型语句:
1 |
|
- 搜索型语句:(like)
1 |
|
通过三种语句的对比可以看见,在字符型语句中变量是需要使用到引号的,而在搜索类型中则需要注释单引号’、百分号%、括号等,这个需要自己进行多次尝试,搜索语句的类型并不多。因此我们的参数值在注入的时候需要去注意类型的判别。
json类型:
3.请求方法
不同的请求方式,上传的数据类型和大小是有区别的。我们不在上传的时候要根据请求的发送进行提交相关的语句,因此同的请求方法可能会有着不同注入的写法和方式。
1 |
|
(注:在java、python等语言的框架中基本也是一样的思路,只是写法可能会有细微的出入)
我们尝试发送数据http://127.0.0.1/liaoyue.php/?g=123&p=456


接下来修改传送方法,通过火狐插件 HackBar 在post提交p。


最终效果:


这也就是说我们注入的位置是有要求和限制的,不同的请求方式会导致我们注入位置形成影响
首先明确cookie并不是请求方法,是在数据包中cookie可以通过修改数据包中的cookie进行注入

既可以通过GET请求,也可以通过POST请求,基本可以说可以REQUST能在所有方法的位置提交。

当然,在post请求的方法中也只是将位置接在post传输的数据后面,其他没有区别。
1 |
|
测试网址:http://ip.tool.chinaz.com/


SQL注入——类型及提交方法
https://one-null-pointer.github.io/2022/08/05/SQL注入——类型及提交方法/