Skip to content

Commit

Permalink
Docker setup
Browse files Browse the repository at this point in the history
  • Loading branch information
goreil committed Apr 23, 2024
1 parent 8e4af70 commit 6e5f1c8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
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

0 comments on commit 6e5f1c8

Please sign in to comment.