forked from USTC-Hackergame/hackergame2024-writeups
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: taoky <[email protected]> Co-authored-by: Mingliang Zeng <[email protected]> Co-authored-by: zzh1996 <[email protected]> Co-authored-by: tl2cents <[email protected]> Co-authored-by: avavaaya <[email protected]> Co-authored-by: Yanbing Zhao <[email protected]> Co-authored-by: Elsa <[email protected]> Co-authored-by: Jiahong Luo <[email protected]> Co-authored-by: RTXUX <[email protected]> Co-authored-by: Erina Init <[email protected]> Co-authored-by: Jiyan He <[email protected]> Co-authored-by: regymm <[email protected]> Co-authored-by: zeredy879 <[email protected]> Co-authored-by: Hypercube <[email protected]> Co-authored-by: emc2314 <[email protected]> Co-authored-by: MirageTurtle <[email protected]> Co-authored-by: TianKai Ma <[email protected]> Co-authored-by: iBug <[email protected]>
- Loading branch information
Showing
580 changed files
with
70,144 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
**/noVNC/* | ||
players/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
## 描述 | ||
|
||
## 检查表 | ||
|
||
- [ ] 我已经阅读并检查以下注意事项: | ||
|
||
- 选手提交的 write-up 的主要内容需要在本仓库存档,仅仅提供到自己博客的题解链接的 Pull requests 不会被合并。 | ||
- 选手提交的 write-up 可以添加自己的博客链接,以及指定 License(如不指定,则默认与本仓库相同,见版权声明一节)。 | ||
- 请编辑仓库根目录下的 README.md 文件,在“来自选手”表格底部加入一行,格式请参考其他行。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.DS_Store | ||
__pycache__/ |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# hackergame2024-writeups | ||
|
||
本文档收集整理了中国科学技术大学第十一届信息安全大赛的官方与非官方题解。 | ||
|
||
该仓库仍在活跃更新中,欢迎各位选手以 Pull Request 的形式提交自己的 write-up(players 目录下以自己的昵称创建新文件夹,并在本文件的「来自选手」部分增加一行)。 | ||
|
||
若大家对本题解有任何疑问或改进建议,欢迎 [提 issue](https://github.com/USTC-Hackergame/hackergame2024-writeups/issues/new)。 | ||
|
||
比赛平台:[https://hack.lug.ustc.edu.cn/](https://hack.lug.ustc.edu.cn/) | ||
|
||
比赛时间:北京时间 2024 年 11 月 02 日 中午 12:00 ~ 11 月 09 日 中午 12:00(共七天) | ||
|
||
## 目录 | ||
|
||
### 官方题解 | ||
|
||
部分题目需要使用 token。Token 可以从比赛平台注册获取,也可以使用 `1:MEYCIQDPvuDMCIJsufFjqavyJZ3ooYVVMyl9VTWO8e6VENQU6wIhALodATitRMxAaj1h4I2eU4VLQRlaGOXk41ZZ97P3+JIK` 作为测试 token。 | ||
|
||
| 题目描述与 write-up | 文件、源代码 | | ||
| ------------------------------------------------------------ | ------------------------------------------------------- | | ||
| [签到](official/签到/README.md) | - | | ||
| [喜欢做签到的 CTFer 你们好呀](official/喜欢做签到的%20CTFer%20你们好呀/README.md) | - | | ||
| [猫咪问答(Hackergame 十周年纪念版)](official/猫咪问答(Hackergame%20十周年纪念版)/README.md) | - | | ||
| [打不开的盒](official/打不开的盒/README.md) | [文件](official/打不开的盒/files) | | ||
| [每日论文太多了!](official/每日论文太多了!/README.md) | - | | ||
| [比大小王](official/比大小王/README.md) | [文件、源代码](official/比大小王/src) | | ||
| [旅行照片 4.0](official/旅行照片%204.0/README.md) | - | | ||
| [不宽的宽字符](official/不宽的宽字符/README.md) | [文件、源代码](official/不宽的宽字符/src) | | ||
| [PowerfulShell](official/PowerfulShell/README.md) | [文件、源代码](official/PowerfulShell/src) | | ||
| [Node.js is Web Scale](official/Node.js%20is%20Web%20Scale/README.md) | [文件、源代码](official/Node.js%20is%20Web%20Scale/src) | | ||
| [PaoluGPT](official/PaoluGPT/README.md) | [文件、源代码](official/PaoluGPT/src) | | ||
| [强大的正则表达式](official/强大的正则表达式/README.md) | [文件](official/强大的正则表达式/files) | | ||
| [惜字如金 3.0](official/惜字如金%203.0/README.md) | [文件](official/惜字如金%203.0/files) | | ||
| [优雅的不等式](official/优雅的不等式/README.md) | [文件](official/优雅的不等式/files) | | ||
| [无法获得的秘密](official/无法获得的秘密/README.md) | [文件、源代码](official/无法获得的秘密/src) | | ||
| [Docker for Everyone Plus](official/Docker%20for%20Everyone%20Plus/README.md) | [文件、源代码](official/Docker%20for%20Everyone%20Plus/src) | | ||
| [看不见的彼方:交换空间](official/看不见的彼方:交换空间/README.md) | [文件、源代码](official/看不见的彼方:交换空间/src) | | ||
| [ZFS 文件恢复](official/ZFS%20文件恢复/README.md) | [文件、源代码](official/ZFS%20文件恢复/src) | | ||
| [链上转账助手](official/链上转账助手/README.md) | [文件、源代码](official/链上转账助手/src) | | ||
| [不太分布式的软总线](official/不太分布式的软总线/README.md) | [文件、源代码](official/不太分布式的软总线/src) | | ||
| [RISC-V:虎胆龙威](official/RISC-V:虎胆龙威/README.md) | [文件、源代码](official/RISC-V:虎胆龙威/src) | | ||
| [动画分享](official/动画分享/README.md) | [文件、源代码](official/动画分享/src) | | ||
| [LESS 文件查看器在线版](official/LESS%20文件查看器在线版/README.md) | [文件、源代码](official/LESS%20文件查看器在线版/src) | | ||
| [关灯](official/关灯/README.md) | [文件](official/关灯/files) | | ||
| [禁止内卷](official/禁止内卷/README.md) | [文件、源代码](official/禁止内卷/src) | | ||
| [我们的快排確有問題](official/我们的快排確有問題/README.md) | [文件、源代码](official/我们的快排確有問題/src) | | ||
| [图灵完备的浮点数减法](official/图灵完备的浮点数减法/README.md) | [文件、源代码](official/图灵完备的浮点数减法/src) | | ||
| [哈希三碰撞](official/哈希三碰撞/README.md) | [文件、源代码](official/哈希三碰撞/src) | | ||
| [零知识数独](official/零知识数独/README.md) | [文件、源代码](official/零知识数独/src) | | ||
| [神秘代码 2](official/神秘代码%202/README.md) | [文件、源代码](official/神秘代码%202/src) | | ||
| [新生赛上的零解题](official/新生赛上的零解题/README.md) | [文件、源代码](official/新生赛上的零解题/src) | | ||
| [认证恢复码](official/认证恢复码/README.md) | [文件、源代码](official/认证恢复码/src) | | ||
| [cat 绿色破解版](official/cat%20绿色破解版/README.md) | [文件、源代码](official/cat%20绿色破解版/src) | | ||
| [先不说关于我从零开始独自在异世界转生成某大厂家的 LLM 龙猫女仆这件事……](official/先不说关于我从零开始独自在异世界转生成某大厂家的%20LLM%20龙猫女仆这件事……/README.md) | [文件、源代码](official/先不说关于我从零开始独自在异世界转生成某大厂家的%20LLM%20龙猫女仆这件事……/src) | | ||
|
||
### 来自选手 | ||
|
||
**注意:选手提交的 write-up 需要在本仓库存档,仅仅提供到自己博客的题解链接的 Pull requests 不会被合并。在自己的 write-up 中可以添加自己的博客链接,以及指定 License(如不指定,则默认与本仓库相同,见 [版权声明](#版权声明) 一节)。** | ||
|
||
| write-up | 备注 | 包含题目 | | ||
| - | - | - | | ||
| [样例](players/example/README.md) | 样例,供参考 | 签到 | | ||
|
||
## 其他资源 | ||
|
||
[Hackergame 2024 幕后工作人员](https://hack.lug.ustc.edu.cn/credits/) | ||
|
||
[搞笑 Flag & 花絮(暂缺)](./behind-the-scenes/README.md) | ||
|
||
### 历年题解 | ||
|
||
- [中国科学技术大学第十届信息安全大赛(Hackergame 2023)题解](https://github.com/USTC-Hackergame/hackergame2023-writeups) | ||
- [中国科学技术大学第九届信息安全大赛(Hackergame 2022)题解](https://github.com/USTC-Hackergame/hackergame2022-writeups) | ||
- [中国科学技术大学第八届信息安全大赛(Hackergame 2021)题解](https://github.com/USTC-Hackergame/hackergame2021-writeups) | ||
- [中国科学技术大学第七届信息安全大赛(Hackergame 2020)题解](https://github.com/USTC-Hackergame/hackergame2020-writeups) | ||
- [中国科学技术大学第六届信息安全大赛(Hackergame 2019)题解](https://github.com/ustclug/hackergame2019-writeups) | ||
- [中国科学技术大学第五届信息安全大赛(Hackergame 2018)题解](https://github.com/ustclug/hackergame2018-writeups) | ||
- [中国科学技术大学第四届信息安全大赛(Hackergame 2017)题解](https://volltin.gitbooks.io/hackergame2017-writeup/) | ||
|
||
### 知乎问题 | ||
|
||
- [知乎:参加中国科学技术大学第十届信息安全大赛(Hackergame 2023)是怎样一种体验?](https://www.zhihu.com/question/628188912) | ||
- [知乎:参加中国科学技术大学第九届信息安全大赛(Hackergame 2022)是怎样一种体验?](https://www.zhihu.com/question/561919414) | ||
- [知乎:参加中国科学技术大学第八届信息安全大赛(Hackergame 2021)是怎样一种体验?](https://www.zhihu.com/question/492960717) | ||
- [知乎:参加中国科学技术大学第七届信息安全大赛(Hackergame 2020)是怎样一种体验?](https://www.zhihu.com/question/428140079) | ||
- [知乎:参加中国科学技术大学第六届信息安全大赛(Hackergame 2019)是怎样一种体验?](https://www.zhihu.com/question/351947330) | ||
- [知乎:参加中国科学技术大学第五届信息安全大赛(Hackergame 2018)是怎样一种体验?](https://www.zhihu.com/question/297850153) | ||
- [知乎:参加中科大第四届信息安全大赛是一种怎样的体验?](https://www.zhihu.com/question/67050288) | ||
|
||
## 版权声明 | ||
|
||
<!-- autocorrect-disable --> | ||
|
||
Copyright (c) USTC Hackergame 2024(中国科学技术大学第十一届信息安全大赛组委会). All rights reserved. | ||
|
||
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="知识共享许可协议" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a><br />本作品题解部分与未特别标注的源代码部分采用<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议</a>进行许可,特别标注的部分以标注的许可协议进行许可。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# Docker for Everyone Plus | ||
|
||
题解作者:[RTXUX](https://github.com/RTXUX) | ||
|
||
出题人、验题人、文案设计等:见 [Hackergame 2024 幕后工作人员](https://hack.lug.ustc.edu.cn/credits/)。 | ||
|
||
## 题目描述 | ||
|
||
- 题目分类:general | ||
|
||
- 题目分值:No Enough Privilege(200)+ Unbreakable!(200) | ||
|
||
X 是实验室机器的管理员,为了在保证安全的同时让同学们都用上 Docker,之前他直接将同学的用户加入 `docker` 组,但在去年参加了信息安全大赛之后,他发现将用户加入 `docker` 用户组相当于给了 root 权限。于是他想到了一个好方法,只授予普通用户使用 `sudo` 运行特定 Docker 命令的权限,这样就不需要给同学完整的 sudo 权限,也不用将同学加入 `docker` 组了! | ||
|
||
但果真如此吗? | ||
|
||
--- | ||
|
||
本题有两个小题。 | ||
|
||
- 可以使用 202.38.93.141 的 10338 端口或 [这个链接](http://202.38.93.141:10339/?token={token}) 访问第一小题。 | ||
- 可以使用 202.38.93.141 的 10340 端口或 [这个链接](http://202.38.93.141:10341/?token={token}) 访问第二小题。 | ||
|
||
--- | ||
|
||
提供的环境会自动登录低权限的 `user` 用户。登录后可以通过特定的 `sudo docker` 命令使用 Docker,通过 `sudo -l` 可以查看允许提权执行的命令。读取 `/flag`(注意其为软链接)获取 flag。 | ||
|
||
提供的环境中有 `rz` 命令,可以使用 ZMODEM 接收文件。 | ||
|
||
题目环境运行 15 分钟后会自动关闭。 | ||
|
||
你可以在下面列出的两种方法中任选其一来连接题目: | ||
|
||
- 点击上面的链接,通过网页终端与远程交互。如果采用这种方法,在正常情况下,你不需要手动输入 token。 | ||
- 在 Linux、macOS、WSL 或 Git Bash 等本地终端中使用 `stty raw -echo; nc 202.38.93.141 10338; stty sane`(第一小题)或 `stty raw -echo; nc 202.38.93.141 10340; stty sane`(第二小题)命令来连接题目。如果采用这种方法,你必须手动输入 token(复制粘贴也可)。**注意,输入的 token 不会被显示,输入结束后按 Ctrl-J 即可开始题目。** | ||
|
||
无论采用哪种方法连接题目,启动题目均需要数秒时间,出现黑屏是正常现象,请耐心等待。 | ||
|
||
> 如果你不知道 `nc` 是什么,或者在使用上面的命令时遇到了困难,可以参考我们编写的 [萌新入门手册:如何使用 nc/ncat?](https://lug.ustc.edu.cn/planet/2019/09/how-to-use-nc/) | ||
## 题解 | ||
|
||
这题是 @taoky 根据我在某实验室的集群上~~手痒~~提权的经历产生的 idea,我负责实现。去年 [Docker for Everyone](https://github.com/USTC-Hackergame/hackergame2023-writeups/blob/master/official/Docker%20for%20Everyone/README.md) 这题指出了 `docker` 用户组和 `root` 事实上是等价的,然而今年我看到有实验室集群使用受限 sudo 的方案来让大家能使用 Docker,但这种方案要处理的 corner case 很多,难以正确实现。 | ||
|
||
### No Enough Privilege | ||
|
||
这个小题很简单,观察 `sudo -l` 的输出,发现 `user` 用户可以执行 `docker image load`,但 `docker run` 不能指定 `root` 用户,因此只需要制作自定义镜像,在其中嵌入合适的具有 SUID 的程序用来提权即可。下面的 Dockerfile 构建了一个简单的镜像。 | ||
|
||
```Dockerfile | ||
FROM docker.io/library/alpine:latest | ||
|
||
RUN apk add --no-cache su-exec && \ | ||
chmod +s /sbin/su-exec | ||
``` | ||
|
||
然后将该镜像导出后使用 ZModem 上传至环境,执行 `sudo docker image load` 导入,最后执行并把主机 `/` 挂入容器,提权即可获得 flag。 | ||
|
||
```sh | ||
docker run --rm -u 1000:1000 -it -v /:/host:ro (image name) | ||
exec su-exec root /bin/ash | ||
cat /host/flag | ||
``` | ||
|
||
### Unbreakable! | ||
|
||
这个小题稍微增加了一些限制,从 `sudo -l` 可以看出 `docker run` 命令必须带上 `--security-opt=no-new-privileges` 参数,因此不能在容器内提权。但注意到 `mount` 的输出中 `/var/lib/docker` 挂载点没有 `nodev` 选项,而 flag 又位于 `/dev/vdb`,具有固定的设备号,因此我们可以加载一个带对应设备文件,且该文件所有者为 1000:1000 的镜像来读取 flag。 | ||
|
||
然而,Docker 采用了 cgroup 进行资源限制,其中 Device Controller 阻止容器访问未经授权的设备,同时也可以注意到,运行带 `--privileged` 或 `--device` 的 Docker 命令是被禁止的,因此无法从容器内读取 flag。但我们可以另辟蹊径,procfs 中提供了一个“穿越点”,即 `/proc/<pid>/root`,可以用于访问对应进程的挂载命名空间的根目录,而 `sudo docker run` 启动的容器是以 `user` 的 UID 执行的,因此 `user` 可以访问主机上 procfs 中容器内进程的目录。所以只需要预制一个带已修改所有者的设备文件的镜像,使用该镜像启动一个 `sleep` 命令,然后在主机上 `ps` 查看 `sleep` 命令的 PID,读取 `/proc/<pid>/root/flag` 即可得到 flag。 | ||
|
||
构建解题镜像的 Dockerfile: | ||
|
||
```Dockerfile | ||
FROM docker.io/library/alpine:latest | ||
|
||
RUN mknod /flag b 253 16 && \ | ||
chown 1000:1000 /flag | ||
``` | ||
|
||
## 附注 | ||
|
||
@taoky: | ||
|
||
看到群里很多人在困惑如何使用 ZMODEM 协议传文件。其中一个坑点是需要在 `/tmp`(或者其他 tmpfs)下面接收数据,因为其他部分是只读文件系统。`sz` 只会显示 "skipped: xxx" 而不会显示传输失败原因。 | ||
|
||
以下给出几种我本地测试有效的方法。这些方法都需要**本地安装 `lrzsz`**。注意 Arch Linux 用户需要使用 `lrzsz-sz` 而非 `sz`。 | ||
|
||
1. `screen` | ||
|
||
启动 `screen` 之后在其中 `nc` 连接,启动成功,输入 `rz` 后按下 Ctrl + A,然后输入 `:exec !! sz /path/to/yourfile`。 | ||
|
||
2. [Konsole](https://apps.kde.org/zh-cn/konsole/) | ||
|
||
`nc` 连接之后输入 `rz`,然后在弹出的文件对话框中选择对应的文件即可。 | ||
|
||
至于 Windows 用户,我也不知道咋上传。 | ||
|
||
因为工期比较紧张,所以最后用了 ZMODEM 这种比较低效的方法处理,网页 nc 也没有做相关的逻辑。之后如果还有 ZMODEM 的题目的话可能会考虑做一下网页端的处理,当然更有可能是用更加正常的协议来做文件上传。 |
14 changes: 14 additions & 0 deletions
14
official/Docker for Everyone Plus/src/docker_for_everyone_1/.env
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
port=10338 | ||
web_port=10339 | ||
nc_host=front | ||
nc_port=2333 | ||
nc_raw=1 | ||
conn_interval=10 | ||
token_timeout=30 | ||
challenge_timeout=900 | ||
pids_limit=128 | ||
mem_limit=2048m | ||
flag_path=/flag | ||
flag_rule=f"flag{{dONT_1OAD_uNTRusT3D_1ma6e_{sha256(sha256('d0cker'+token))[:10]}_plz!}}" | ||
challenge_docker_name=docker_for_everyone_1_challenge | ||
read_only=1 |
17 changes: 17 additions & 0 deletions
17
official/Docker for Everyone Plus/src/docker_for_everyone_1/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM ustclug/debian:bookworm | ||
|
||
ARG PASSWORD=YaFLxjwrXVkuUMKqZ2Lt | ||
RUN apt update && apt -y upgrade && \ | ||
apt install --no-install-recommends -y qemu-system wget p7zip-full ca-certificates | ||
|
||
ADD src /src | ||
WORKDIR /src | ||
|
||
RUN \ | ||
wget "https://ftp.lug.ustc.edu.cn/~rtxux/1a62f0e6-98da-4dd6-8f8e-978bbc02ad08/2024-004.7z" && \ | ||
7z x "-p${PASSWORD}" 2024-004.7z && \ | ||
echo "cd81f0a3ab2b137017390028f0b852533785809a9516a01a3d95500bde461b92 alpine.qcow2" | sha256sum -c && \ | ||
echo "71048b2825bfd67cf436d8df4557daa462ecc1c38fa6e1e16fbf966fcd0c6ccf alpine_2.qcow2" | sha256sum -c && \ | ||
rm 2024-004.7z | ||
|
||
CMD ["/src/run.sh", "./alpine.qcow2"] |
18 changes: 18 additions & 0 deletions
18
official/Docker for Everyone Plus/src/docker_for_everyone_1/docker-compose.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
version: '2.4' | ||
|
||
services: | ||
challenge: | ||
build: | ||
context: .. | ||
dockerfile: ./docker_for_everyone_1/Dockerfile | ||
entrypoint: ["/bin/true"] | ||
front: | ||
extends: | ||
file: ../../dynamic_flag/docker-compose.yml | ||
service: front | ||
depends_on: | ||
- challenge | ||
web: | ||
extends: | ||
file: ../../web_netcat/docker-compose.yml | ||
service: web |
14 changes: 14 additions & 0 deletions
14
official/Docker for Everyone Plus/src/docker_for_everyone_2/.env
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
port=10340 | ||
web_port=10341 | ||
nc_host=front | ||
nc_port=2333 | ||
nc_raw=1 | ||
conn_interval=10 | ||
token_timeout=30 | ||
challenge_timeout=900 | ||
pids_limit=128 | ||
mem_limit=2048m | ||
flag_path=/flag | ||
flag_rule=f"flag{{contA1N3R_R0ot_i5_4cCESsIb1e_{sha256(sha256('d0ck3r'+token))[:10]}}}" | ||
challenge_docker_name=docker_for_everyone_2_challenge | ||
read_only=1 |
17 changes: 17 additions & 0 deletions
17
official/Docker for Everyone Plus/src/docker_for_everyone_2/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM ustclug/debian:bookworm | ||
|
||
ARG PASSWORD=YaFLxjwrXVkuUMKqZ2Lt | ||
RUN apt update && apt -y upgrade && \ | ||
apt install --no-install-recommends -y qemu-system wget p7zip-full ca-certificates | ||
|
||
ADD src /src | ||
WORKDIR /src | ||
|
||
RUN \ | ||
wget "https://ftp.lug.ustc.edu.cn/~rtxux/1a62f0e6-98da-4dd6-8f8e-978bbc02ad08/2024-004.7z" && \ | ||
7z x "-p${PASSWORD}" 2024-004.7z && \ | ||
echo "cd81f0a3ab2b137017390028f0b852533785809a9516a01a3d95500bde461b92 alpine.qcow2" | sha256sum -c && \ | ||
echo "71048b2825bfd67cf436d8df4557daa462ecc1c38fa6e1e16fbf966fcd0c6ccf alpine_2.qcow2" | sha256sum -c && \ | ||
rm 2024-004.7z | ||
|
||
CMD ["/src/run.sh", "./alpine_2.qcow2"] |
18 changes: 18 additions & 0 deletions
18
official/Docker for Everyone Plus/src/docker_for_everyone_2/docker-compose.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
version: '2.4' | ||
|
||
services: | ||
challenge: | ||
build: | ||
context: .. | ||
dockerfile: ./docker_for_everyone_2/Dockerfile | ||
entrypoint: ["/bin/true"] | ||
front: | ||
extends: | ||
file: ../../dynamic_flag/docker-compose.yml | ||
service: front | ||
depends_on: | ||
- challenge | ||
web: | ||
extends: | ||
file: ../../web_netcat/docker-compose.yml | ||
service: web |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
set -eu | ||
|
||
IMAGE="${1}" | ||
|
||
exec qemu-system-x86_64 \ | ||
-kernel ./vmlinuz-virt -initrd ./initramfs-virt \ | ||
-device virtio-blk,drive=alpine \ | ||
-blockdev "driver=qcow2,file.filename=${IMAGE},file.driver=file,node-name=alpine,read-only=true,auto-read-only=true,cache.direct=on" \ | ||
-append "root=UUID=47a6765a-021c-47f0-830b-de4d8bb9d727 ro modules=ext4 quiet rootfstype=ext4 oops=panic panic=1 console=ttyS0" \ | ||
-m 256m \ | ||
-device virtio-blk,drive=flag \ | ||
-blockdev driver=raw,file.filename=/flag,file.driver=file,node-name=flag,read-only=true,auto-read-only=true \ | ||
-no-reboot -monitor /dev/null -nic none -nographic \ |
Binary file not shown.
Oops, something went wrong.