This is a template for your docker image that will be used to host your CTF challenge.
Download the template from the course website and unzip it.
$ wget https://tc.gts3.org/cs6265/2026-fall/_static/ctf-template.zip
$ unzip ctf-template.zip
$ cd ctf-template
$ make help
prepare: prepare a docker image for compilation
build : build the target
dist : build the docker image
release: build the target, docker image and release them
run : run the docker container
exploit: launch the exploit
test : test the docker/exploit
submit : zip for submission
Keep in mind that the best challenge should be fun and educational. Please don't design the challenge that requires any random/pure guessing (but well-designed bruteforcing is fine).
You can replicate real security vulnerabilities, like mini-sudo or
mini-heartbleed. There are a few sources that you can refer:
/NAME : team-name:challenge-name (e.g., `staff:fmtstr`)
/PORT : a port number
# all files to run your service
/docker/Dockerfile : Dockerfile
/target : target binary
/flag : follow this format: tkctf{please submit this flag!}
# all files to be released to participants
/release/README.md : guideline
/target : target binary, if you want to release
# source/exploit for your team and organizer
/source/Dockerfile : Dockerfile for the build environment
/exploit.py : exploit code
/test.sh : run docker, run exploit.py and print out flag
/writeup.txt : solution
/src/ : source code
- Change the
NAMEfile to your challenge name:teamname:challenge(e.g.,staff:fmtstr) - Change the
docker/flagfile as you wish, but wrap it insidetkctf{...}(e.g.,tkctf{please submit this flag!}) make prepareto build a docker container for the build process- Design your challenge under
source/src/- All code and Makefile go to
source/src/ - See
source/src/Makefileto enable/disable mitigation - Put
README.mdunderrelease/README.md make buildto build the challenge
- All code and Makefile go to
make distto prepare a docker image for exploitation- Put an exploit to
source/exploit.py(e.g.,make runandmake exploit) - Make sure everything is ready with
make test make releaseto rebuild everything and copy the target torelease/- Check what's included in
/release/
- Check what's included in
make submitto zip your challenge to../<NAME>.zip, upload it to a shareable link, and submit the link through the form printed bymake submit
The source code of the challenge locates in source/src/, which
contains its source (fmtstr.c) and makefile (Makefile).
The makefile includes various defense options you can enable
(e.g., CFLAGS += -fstack-protector). Please carefully enable them
as you'd like for your challenge.
/NAME: Team/challenge name/release/README.md: Description about the challenge/release/target: the target binary to release/release/*: anything else you would like to make public (e.g. libc)/docker/flag: Flag!/source/writeup.txt: Your description on the challenge and solution/source/exploit.py: Your working exploit- Make sure
make testworks!
- The organizer will run
make distto prepare the docker image - The organizer will release
/release/*via CTFd - Your docker image will be monitored with your exploit script