Skip to content

Commit 9500cf8

Browse files
committed
HITCON CTF Quals 2019 challenges
1 parent 07d7439 commit 9500cf8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+9006
-2
lines changed

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,19 @@ These challenges are created by me so there're scripts for creating them.
140140
* EOP (rev 257pts)
141141
* abyss (pwn 230 + 292 + 262pts)
142142
* groot (pwn 305pts)
143-
* HITCON (327 pts)
144-
* unexecutable (360 pts)
143+
* HITCON (pwn 327pts)
144+
* unexecutable (misc, pwn 360pts)
145+
146+
## hitcon-quals-2019
147+
148+
These challenges are created by me so there're scripts for creating them.
149+
150+
* PoE (pwn 284 + 500 + 500pts)
151+
- [writeup](https://david942j.blogspot.com/2019/10/official-write-up-hitcon-ctf-quals-2019.html)
152+
* Welcome (welcome 50pts)
153+
* Revenge of Welcome (misc 105pts)
154+
* Suicune (rev 305pts)
155+
* heXDump (misc 202pts)
145156

146157
## meepwnctf-2018
147158

hitcon-quals-2019/PoE/DESCRIPTION.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# PoE I - Luna [284pts]
2+
3+
Path of Exploitation I
4+
5+
Try this brand new editor - Luna the Legendary Ultra Note Accelerator!
6+
7+
`nc 13.230.132.4 21700`
8+
9+
Author: david942j
10+
11+
20 Teams solved.
12+
13+
14+
# PoE II - Cord [500pts]
15+
16+
Path of Exploitation II
17+
18+
Who needs C++ string if there is Linux cord?
19+
20+
`nc 13.230.132.4 21701`
21+
22+
Author: david942j
23+
24+
Nobody solved yet.
25+
26+
Hint
27+
28+
*Corrupted queue is good*
29+
30+
Hint
31+
32+
*Race condition is not needed to trigger the bug*
33+
34+
35+
# PoE III - TPU [500pts]
36+
37+
Path of Exploitation III
38+
39+
Everything could be HW-accelerated.
40+
41+
`nc 13.230.132.4 21702`
42+
43+
Author: david942j
44+
45+
Nobody solved yet.

hitcon-quals-2019/PoE/Makefile

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
FLAG1 ?= <FLAG1 WILL BE HERE>
2+
FLAG2 ?= <FLAG2 WILL BE HERE>
3+
DISK ?= disk
4+
INIT ?= init
5+
6+
all: qemu kernel user test solution fs
7+
8+
release: qemu kernel user
9+
rm -fr release/disk_clean
10+
tar xf disk_clean.tar.gz -C release/
11+
# bios
12+
mkdir -p release/pc-bios
13+
cp qemu/build/pc-bios/bios-256k.bin release/pc-bios
14+
cp qemu/build/pc-bios/kvmvapic.bin release/pc-bios
15+
cp qemu/build/pc-bios/linuxboot_dma.bin release/pc-bios
16+
cp qemu/build/pc-bios/vgabios-stdvga.bin release/pc-bios
17+
cp qemu/build/pc-bios/efi-e1000.rom release/pc-bios
18+
# qemu
19+
mkdir -p release/x86_64-softmmu
20+
cp qemu/build/x86_64-softmmu/qemu-system-x86_64 release/x86_64-softmmu
21+
# kernel
22+
cp linux/arch/x86_64/boot/bzImage release/
23+
cp linux/drivers/misc/tpu/tpu.ko release/
24+
cp linux/drivers/misc/tpu/tpu.ko release/disk_clean
25+
# user
26+
cp src/luna release/luna
27+
cp src/luna release/disk_clean/home/poe/
28+
$(MAKE) DISK=release/disk_clean INIT=init_release fs
29+
rm -fr release/disk_clean
30+
cd release && tar cvfz ../poe.tar.gz *
31+
32+
deploy: .PHONY
33+
$(MAKE) 'FLAG1=<FLAG1 WILL BE HERE>' 'FLAG2=<FLAG2 WILL BE HERE>' release
34+
rm -fr deploy/disk deploy/x86_64-softmmu deploy/pc-bios
35+
tar xf disk_clean.tar.gz -C deploy/
36+
mv deploy/disk_clean deploy/disk
37+
cp -r release/pc-bios release/x86_64-softmmu release/bzImage deploy/
38+
cp release/tpu.ko deploy/disk/
39+
cp release/luna deploy/disk/home/poe
40+
$(MAKE) DISK=deploy/disk INIT=init_release fs
41+
mv deploy/initramfs.cpio.gz deploy/poe1.cpio.gz
42+
cd deploy && tar cvfz ../deploy.tar.gz *
43+
44+
fs:
45+
echo "$(FLAG1)" > $(DISK)/home/poe/flag1
46+
echo "$(FLAG2)" > $(DISK)/flag2
47+
cp src/disk/$(INIT) $(DISK)/init
48+
cd $(DISK) && find . | cpio -o -Hnewc | gzip -9 > ../initramfs.cpio.gz
49+
50+
test:
51+
$(MAKE) -C tests
52+
rm -fr disk/tests/
53+
cp -r tests/ disk/
54+
$(MAKE) fs
55+
56+
solution:
57+
$(MAKE) -C sol
58+
cp sol/cord_exp disk/
59+
cp sol/tpu_exp disk/
60+
$(MAKE) fs
61+
62+
user: src/luna.c
63+
$(CXX) src/luna.c -o src/luna -I./src/linux/include/uapi/ -static
64+
cp src/luna disk/home/poe/
65+
$(MAKE) fs
66+
67+
qemu: src/qemu/hw/misc/tpu.c src/qemu/hw/misc/tpu-ir.h
68+
cp src/qemu/hw/misc/tpu.c qemu/hw/misc/
69+
cp src/qemu/hw/misc/tpu-ir.h qemu/hw/misc/
70+
# mkdir -p qemu/build && cd /home/PoE/qemu/build && ../configure --target-list=x86_64-softmmu && make -j `nproc`
71+
cd /home/PoE/qemu/build && make -j `nproc`
72+
strip --strip-debug qemu/build/x86_64-softmmu/qemu-system-x86_64
73+
74+
kernel: src/linux/drivers/misc/tpu/tpu-*.c src/linux/drivers/misc/tpu/tpu-*.h src/linux/include/uapi/linux/cord.h
75+
rm -rf linux/drivers/misc/tpu
76+
cp -r src/linux/drivers/misc/tpu linux/drivers/misc/
77+
cp src/qemu/hw/misc/tpu-ir.h qemu/hw/misc/
78+
cp src/linux/include/uapi/linux/cord.h linux/include/linux
79+
cd linux && make -j `nproc`
80+
strip --strip-debug linux/drivers/misc/tpu/tpu.ko
81+
cp linux/drivers/misc/tpu/tpu.ko disk/
82+
$(MAKE) fs
83+
84+
.PHONY:

hitcon-quals-2019/PoE/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DESCRIPTION.md
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Path of Exploitation
2+
3+
## PoE I - Luna
4+
5+
- Analyze the binary `luna` should be enough for solving this challenge.
6+
- There's a proof-of-work challenge on remote service.
7+
8+
## PoE II - Cord
9+
10+
- No PoW, but you have to solve PoE I to get the password for this challenge.
11+
- A file uploader is provided on remote for your convenience.
12+
- Linux commit 4d856f72c10ecb060868ed10ff1b1453943fc6c8, tag: v5.3
13+
14+
## PoE III - TPU
15+
16+
- Solve PoE II to get the password for this challenge.
17+
- Don't waste time on the binaries under pc-bios/, they are normal BIOS.
18+
- You can upload a file as PoE II does, the uploaded file will be executed under *root* permission.
19+
- Flag: `/home/poe/flag` on host.
20+
- Run on the latest Ubuntu 18.04.
21+
- QEMU commit 9e06029aea3b2eca1d5261352e695edc1e7d7b8b, tag: v4.1.0
22+
23+
24+
* All services have a hard timeout 120 seconds.
12.3 MB
Binary file not shown.

hitcon-quals-2019/PoE/sol/Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
all: cord_exp tpu_exp
2+
3+
cord_exp: cord_exp.c
4+
$(CC) -o cord_exp -static cord_exp.c
5+
strip cord_exp
6+
tpu_exp: tpu_exp.c
7+
$(CXX) -o tpu_exp -static tpu_exp.c
8+
strip tpu_exp

hitcon-quals-2019/PoE/sol/cord_exp

872 KB
Binary file not shown.

0 commit comments

Comments
 (0)