Apache HTTPD 支持一个文件拥有多个后缀,并为不同后缀执行不同的指令。比如,如下配置文件:
AddType text/html .html
AddLanguage zh-CN .cn
其给.html
后缀增加了media-type,值为text/html
;给.cn
后缀增加了语言,值为zh-CN
。此时,如果用户请求文件index.cn.html
,他将返回一个中文的html页面。
以上就是Apache多后缀的特性。如果运维人员给.php
后缀增加了处理器:
AddHandler application/x-httpd-php .php
那么,在有多个后缀的情况下,只要一个文件含有.php
后缀的文件即将被识别成PHP文件,没必要是最后一个后缀。利用这个特性,将会造成一个可以绕过上传白名单的解析漏洞。
拉取docker容器

访问本机IP


发现不能直接上传木马,抓包分析原因

发现是限制了文件扩展名和文件类型,这里没有发现文件包含漏洞,怎么利用上传的木马文件,这里就需要利用前面的多后缀解析漏洞,将文件修改为1.php.png
环境运行后,访问`http://your-ip/uploadfiles/1.php.png\`即可发现,phpinfo被执行了,该文件被解析为php脚本。


访问发现木马上传成功,再用蚁剑连接
