Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker setup overhaul #179

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
from ubuntu:20.04
# Ubuntu 20.04 is used due to Issue #169
ARG image=mcr.microsoft.com/devcontainers/base:focal
FROM $image

# Build dependencies
run apt-get update && apt-get install -y binutils git make vim gcc patchelf python-is-python3 python3-pip
run pip3 install requests

# Build how2heap
run git clone --depth 1 https://github.com/shellphish/how2heap /root/how2heap
run cd /root/how2heap && make clean all

# pwndbg
ENV LC_CTYPE=C.UTF-8
run git clone --depth 1 https://github.com/pwndbg/pwndbg /root/pwndbg
run git config --global --add safe.directory "*"
run cd /root/pwndbg && ./setup.sh

# pwntools
run pip3 install requests pwntools


workdir /root/how2heap
run bash
workdir /root/how2heap
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,19 @@ Notice that it does not work if you compile the target binary (`malloc_playgroun

## Complete Setup

This uses Docker-based approach to prepare the needed environment
This uses Docker-based approach to prepare the needed environment with pwndbg

```shell
git clone https://github.com/shellphish/how2heap
cd how2heap

# the next command will prepare the target binary so it runs with
# the expected libc version
./glibc_run.sh 2.30 ./malloc_playground -d -p
docker build -t how2heap-pwndbg .
docker run --rm -it --cap-add=SYS_PTRACE --security-opt seccomp=unconfined how2heap-pwndbg bash

# now you can play with the binary with glibc-2.30
# and even debug it with the correct symbols
readelf -d -W malloc_playground | grep RUNPATH # or use checksec
readelf -l -W malloc_playground | grep interpreter
# Inside the docker container
./glibc_run.sh 2.30 ./malloc_playground

# Debugging with pwndbg
gdb -q -ex "start" ./malloc_playground
```

Expand Down