要想开启PUT,需要修改PHPstudy的配置文件。

?根据路径打开配置文件,启用模块,记得对修改的模块备份
启用模块

?添加目录

根据自己的路径修改,记得保存,重启服务 ,
可以通过BP抓取上传文件的包,对上传类型进行修改,也可通过kali自带的cadaver来实现

?通过help可以指定支持哪些命令使用?

lls是查看本机的文件,ls是查看服务器的文件,通过put上传一句话木马,使用蚁剑链接。

?蚁剑成功连接,

而目录下也有1.php?
metinfov5.0.4

?漏洞位置
http://192.168.40.137/MetInfo5.0.4/admin/include/uploadify.php
uploadify.php

看到包含"common.inc.php"? 查看
?看到在管理员权限一栏有SQL认证,但并未添加过滤,存在绕过。

文件上传类型也有限制?

可以采用双写绕过(pphphp)?
编写表单
<html>
<form enctype="multipart-data" method="post"
name="myForm"
action="http://192.168.40.137/MetInfo5.0.4/admin/include/uploadify.php?
、、metinfo_admin_id=root&metinfo_admin_pass=root&met_admin_table=met_admin_table#&type=upfile&met_file_format=jpg|pphphp
">
<input name="Filedata" type="file" size=20>
<input type="submit" name="Submit" value="0.0">
</html>

metinfov5.0.4的10.21更新
基于面对代码,进行代码审计,利用工具对整个网站的代码进行一个扫描审计

看到可能存有文件包含漏洞,对源码进行一个访问。

可以看到 require_once $module,还有require_once '../include/module.php',对module.php进行查看。

找到$module,?在没有对$module传参的时候,直接返回一个404.html,最下面对$module给予了一个值,且文件开头又包含了另一个文件

进行访问

?看到cookei、post、get、三个传参方法,中间还有$$_request,? $_key是键,$value是值,
对该串代码进行测试

?访问:

看到输出了Feng_Blue
对$name进行修改

?在url中对name进行赋值,但源文件中并没有修改,发现在url传递的参数直接覆盖了源文件中的内容。
name=Feng_Blue
name被当成变量名,Feng_Blue为参数值,不传参就输出定义过的name,传参则就覆盖原文件内的name的值,是一个变量覆盖漏洞。
此时我们回到../adout/index/php

尝试替换带$module

?而此时发现,并没有覆盖掉$module,对源代码进行修改,尝试print一下这个$module,记得备份。

?保存源码后刷新
?弹出show.php,再进行赋值:
依旧回显show.php,说明对这个?$module初始化了。

?我们回头查看module.php

?当$fmodule不等于7的时候进行初始化,而我们需要让它等于7。因为$module再if分支。
尝试:

?成功

?查看:\windows\system32\drivers\etc\hosts
文件包含漏洞复现