upload-labs clearance notes

Introduction:
1, using the Upload-Labs is a php language, for collecting all kinds of penetration testing and vulnerability upload Range CTF encountered. It is designed to help you to upload vulnerability
have a comprehensive understanding. At present a total of 20 off, each level contains different ways to upload. (Project Address: https://github.com/c0ny1/upload-labs )
2, contains vulnerabilities drone type classification.

3, how to determine the type of upload vulnerability?

The Upload Labs the Write-up:
Pass to bypass the preceding 01-js examination

delete return checkFile () can be bypassed. Js or disable the browser plug-in and then upload.


Pass-02 Content-type绕过
方法一:绕过前段(删去js限制或者改为.jpg等),通过burpsuite抓包,修改MIME
方法二:加后缀.jpg可直接绕过MIME,但提交时需要抓包删去.jpg

Content-Type: application/octet-stream 改为:Content-Type: image/png 即可上传绕过:

Pass-03 黑名单绕过
绕过黑名单方法较多:使用.php2.phtml.phps、大小写、双写php等。这里使用.php2绕过,实战的话根据服务端配置进行测试。
上传的是.php2这种类型文件的话,如果想要被当成php执行的话,需要有个前提条件,即Apache的httpd.conf有如下配置代码
AddType application/x-httpd-php .php2 .phtml .phps
AddType 指令在给定的文件扩展名与特定的内容类型之间建立映射关系。MIME-type指明了包含extension扩展名的文件的媒体类型。

Pass-04 .htaccess
本pass禁止上传.php|.php5|.php4|.php3|.php2|php1|.html|.htm|.phtml|.pHp|.pHp5|
.pHp4|.pHp3|.pHp2|pHp1|.Html|.Htm|.pHtml|.jsp|.jspa|.jspx|.jsw|.jsv|.jspf|.jtml|
.jSp|.jSpx|.jSpa|.jSw|.jSv|.jSpf|.jHtml|.asp|.aspx|.asa|.asax|.ascx|.ashx|.asmx|
.cer|.aSp|.aSpx|.aSa|.aSax|.aScx|.aShx|.aSmx|.cEr|.sWf|.swf后缀文件!唯独没禁.htaccess后缀!
所以我们构造.htaccess文件:AddType application/x-httpd-php .jpg .conf
这里代码的意思是把.jpg/.conf等后缀名文件以php格式解析,因此达到了可执行的效果。
没有上传.htaccess 文件前:

上传.htaccess 文件后被解析成php文件。

注: .htaccess文件生效前提条件为1.mod_rewrite模块开启。2.AllowOverride All
Pass-05 大小写绕过
加上了.htaccess,但是没有对后缀统一大小,所以我们可以通过大小写绕过:

Pass-06
查看代码,这里将文件后缀名统一进行了小写转换,

但是没有去除文件名首尾的空格。所以我们可以利用windows系统的命名规则进行绕过。

Guess you like

Origin www.cnblogs.com/beret81/p/11992179.html