Skip to content

Commit 754f428

Browse files
committed
[pwn]simple_fmt finish
1 parent dd46490 commit 754f428

File tree

12 files changed

+170
-1
lines changed

12 files changed

+170
-1
lines changed

..gitattributes.un~

4.59 KB
Binary file not shown.

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@
1313
*.7z filter=lfs diff=lfs merge=lfs -text
1414
pwn/race/docker/bin/race filter=lfs diff=lfs merge=lfs -text
1515
pwn/race/challenge filter=lfs diff=lfs merge=lfs -text
16+
17+
pwn/simple_fmt/challenge filter=lfs diff=lfs merge=lfs -text
18+
pwn/simple_fmt/docker/bin/fmt filter=lfs diff=lfs merge=lfs -text

pwn/race/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ race
1010

1111
## 分数
1212

13-
50
13+
75
1414

1515
## flag
1616

pwn/simple_fmt/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Race
2+
3+
## 题目名称
4+
5+
simple_fmt
6+
7+
## 分类
8+
9+
* pwn
10+
11+
## 分数
12+
13+
50
14+
15+
## flag
16+
17+
```txt
18+
zsctf{fmt_gogogo_2020}
19+
```
20+
21+
## develop
22+
23+
```bash
24+
# 测试环境
25+
26+
```
27+
28+
## 题目搭建
29+
30+
```bash
31+
cd pwn/simple_fmt/docker && docker-compose up -d
32+
```
33+
34+
> 修改 docker-compose.yml 环境变量可改变 flag。

pwn/simple_fmt/challenge/fmt

13.3 KB
Binary file not shown.

pwn/simple_fmt/docker/Dockerfile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
FROM ubuntu:18.04
2+
3+
RUN sed -i "s/http:\/\/archive.ubuntu.com/http:\/\/mirrors.tuna.tsinghua.edu.cn/g" /etc/apt/sources.list && \
4+
apt-get update && apt-get -y dist-upgrade && \
5+
apt-get install -y lib32z1 xinetd
6+
7+
RUN useradd -m ctf
8+
9+
WORKDIR /home/ctf
10+
11+
RUN cp -R /lib* /home/ctf && \
12+
cp -R /usr/lib* /home/ctf
13+
14+
RUN mkdir /home/ctf/dev && \
15+
mknod /home/ctf/dev/null c 1 3 && \
16+
mknod /home/ctf/dev/zero c 1 5 && \
17+
mknod /home/ctf/dev/random c 1 8 && \
18+
mknod /home/ctf/dev/urandom c 1 9 && \
19+
chmod 666 /home/ctf/dev/*
20+
21+
RUN mkdir /home/ctf/bin && \
22+
cp /bin/sh /home/ctf/bin && \
23+
cp /bin/ls /home/ctf/bin && \
24+
cp /bin/cat /home/ctf/bin
25+
26+
COPY ./ctf.xinetd /etc/xinetd.d/ctf
27+
COPY ./start.sh /start.sh
28+
RUN echo "Blocked by ctf_xinetd" > /etc/banner_fail
29+
30+
RUN chmod +x /start.sh
31+
32+
COPY ./bin/ /home/ctf/
33+
RUN chown -R root:ctf /home/ctf && \
34+
chmod -R 750 /home/ctf && \
35+
chmod 740 /home/ctf/flag
36+
37+
CMD ["/start.sh"]
38+
39+
EXPOSE 9999

pwn/simple_fmt/docker/bin/flag

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
zsctf{}

pwn/simple_fmt/docker/bin/fmt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:18223164a91d6047f0362f00d5f19595427b06e7cc129f66c01aceb96549c991
3+
size 13608

pwn/simple_fmt/docker/ctf.xinetd

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
service ctf
2+
{
3+
disable = no
4+
socket_type = stream
5+
protocol = tcp
6+
wait = no
7+
user = root
8+
type = UNLISTED
9+
port = 9999
10+
bind = 0.0.0.0
11+
server = /usr/sbin/chroot
12+
server_args = --userspec=1000:1000 /home/ctf ./fmt
13+
banner_fail = /etc/banner_fail
14+
# safety options
15+
per_source = 10 # the maximum instances of this service per source IP address
16+
rlimit_cpu = 20 # the maximum number of CPU seconds that the service may use
17+
#rlimit_as = 1024M # the Address Space resource limit for the service
18+
#access_times = 2:00-9:00 12:00-24:00
19+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: '3'
2+
services:
3+
race:
4+
build:
5+
context: ./
6+
dockerfile: Dockerfile
7+
ports:
8+
- "1001:9999"
9+
environment:
10+
- FLAG=zsctf{fmt_gogogo_2020}

0 commit comments

Comments
 (0)