Pwnbox is a Docker container with tools for binary reverse engineering and exploitation. It's primarily geared towards Capture The Flag competitions.
You can grab the container from Docker Hub: docker pull wardwouts/pwnbox
- Make sure you have Docker installed.
- Optional: Create a
./rc
directory. Your custom configuration files in$HOME
go here. Eg:.gdbinit
,.radare2rc
,.bashrc
,.vimrc
, etc. The contents ofrc
gets copied into/root
on the container. - Get the
pwnbox
script from https://github.com/wardwouts/pwnbox/blob/master/run.sh. - Execute
pwnbox <ctfname>
script which creates a container named<ctfname>
. Eg:
$ ./pwnbox defcon
CTF Name from argument: defcon
Creating container
080ca7f41f34f80ac2bd630633a5b0e21895a7c53a6bf06b252e71d078fd4896
______
___________ ___________ /___________ __
___ __ \_ | /| / /_ __ \_ __ \ __ \_ |/_/
__ /_/ /_ |/ |/ /_ / / / /_/ / /_/ /_> <
_ .___/____/|__/ /_/ /_//_.___/\____//_/|_|
/_/ originally by superkojiman
/_/ forked by wardwouts
To detach container without stopping it type:
CTRL-p CTRL-q
root@defcon:/#
- Works with this .bashrc snippet to automatically get a ctfname from the $cdj value:
export cdj=$(cat $HOME/.cdj)
cdj(){
cd $(cat $HOME/.cdj)
}
scdj(){
if [ -e $HOME/cdj ]; then
rm $HOME/cdj
fi
ln -s $(pwd) $HOME/cdj
pwd > $HOME/.cdj
export cdj=$(cat $HOME/.cdj)
}
- If neither the argument
<ctfname>
is given nor$cdj
is set, it takes the last part of the current path as ctfname. (So/home/username/workdir
would become ctfnameworkdir
. - The
$cdj
directory or current directory will be mounted under/root/work
in the container upon container creation. - To start and/or reattach an existing container simply run the
pwnbox
script again with the same ctf name. - The container engine can be set to podman by setting the following environment variable: DOCKER_COMMAND=podman
- If you need to edit anything in /proc, you must edit
pwnbox
to use the--privileged
option todocker
instead of--cap-add=SYS_PTRACE
.
•_•)
( •_•)>⌐■-■
(⌐■_■)