14 web漏洞,SQL注入之类型及提交注入
? 在真实 SQL 注入安全测试中,我们一定要先明确提交数据及提交方法后再进行注入,其中提交数据类型和提交方法可以通过抓包分析获取, 后续安全测试中我们也必须满足同等的操作才能进行注入。

简要明确参数类型
数字,字符,搜索性,json等
数字型参数

字符型参数

如果字符型参数未加单引号,则会报错
字符型参数注入需要将单引号闭合
如:
select * from users where name = 'xihua and 1=1'
select * from users where name = 'xihua' and 1=1#'
加上单引号进行闭合,并且注释后面的单引号
搜索型参数
将数据进行搜索并进行展示
语句可能为
select * from users where name like ‘%xihua%’
select * from users where name like (’%xihua%’)
则需要注释单引号’、百分号%、括号等,需要自己进行多次尝试
简要明确请求方法
GET,POST,COOKIE,REQUEST,HTTP 头等
根据网站的情况来获取相应的请求方法,请求方法可以通过在访问网站的时候请求头查看

不同的请求方法,不同注入
get请求post请求
<?php
$get=$_GET['q'];
echo $get;
$post=$_POST['p'];
echo $post;
$c=$_COOKIE['c'];
echo $c;
$r=$_REQUEST['r']
echo $r;
$s=$_SERVER['HTTP_USER_AGENT'];
echo $s;
?>

如果在url中提交q与p 
仍然只显示123
通过火狐插件 HackBar 在post提交p


成功显示123456
在网址后面传参为get请求,就算为post请求方式,也可以get方法传递参数
cookie
cookie不是请求方法,是在数据包中cookie
可以通过修改数据包中的cookie进行注入
修改数据包中的cookie 
requset
get post 均为接收单个的,request为全部接收
以get传递参数,接收,以post传递参数,接收,以cookie传递参数,也接收
get

post

cookie

HTTP_USER_AGENT
$_SERVER是PHP里内置变量,全局变量,PHP写脚本时用它来获取系统的值 
有些网站会获取你的设备信息,我们可以从这一个角度进行注入

|