Enable testing of the exploit (#4)

* Enable testing exploit

* Fix unused result warning

* Fix oversight in CI

* Fix oversight in CI II

* Fix oversight in CI III

* Fix oversight in CI IV

* Debugging CI

* Debugging CI

* Debugging CI

* Debugging & supplying custom libc

* Trying out stuff.

* Triggering CI?

* Testing around.

* Fix test_exploit CI.

* Fix test_exploit CI.
This commit is contained in:
Maier Johannes
2024-01-25 00:55:49 +01:00
committed by GitHub
parent a90702d68f
commit b3e3b7b049
6 changed files with 204 additions and 27 deletions

59
tests/Dockerfile Normal file
View File

@@ -0,0 +1,59 @@
FROM debian:bullseye
RUN apt update -y && apt upgrade -y && apt install -y build-essential wget cmake
############### INSTALL FNETD
RUN wget https://cloud.sec.in.tum.de/index.php/s/n5cJnDqnnpSeEpd/download/fnetd.tar.xz -O /fnetd.tar.xz
RUN tar -xf fnetd.tar.xz
RUN mkdir /fnetd/build
WORKDIR /fnetd/build
RUN cmake .. -G "Unix Makefiles"
RUN make
WORKDIR /
############### END INSTALL
## Add dummy get_flag
COPY tests/get_flag.c /bin/get_flag.c
RUN gcc -O3 /bin/get_flag.c -o /bin/get_flag
RUN rm /bin/get_flag.c
## Use course libc
COPY tests/libc-2.31.so /lib/x86_64-linux-gnu/libc-2.31-bx.so
RUN ln -sf /lib/x86_64-linux-gnu/libc-2.31-bx.so /lib/x86_64-linux-gnu/libc.so.6
RUN useradd -m pwn
COPY . /home/pwn/source
# compile vuln in debug mode
RUN mkdir /home/pwn/debug
WORKDIR /home/pwn/debug
RUN cmake /home/pwn/source -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug
RUN make
RUN mkdir /home/pwn/release
WORKDIR /home/pwn/release
RUN cmake /home/pwn/source -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release
RUN make
RUN chown -R pwn:pwn /home/pwn
ARG FNETD_PASSWORD
ENV FNETD_PASSWORD $FNETD_PASSWORD
ARG RELEASE_PORT
ENV PORT_RELEASE $RELEASE_PORT
ARG DEBUG_PORT
ENV PORT_DEBUG $DEBUG_PORT
EXPOSE $DEBUG_PORT
EXPOSE $RELEASE_PORT
WORKDIR /home/pwn
RUN cp /home/pwn/source/activation_key.txt activation_key.txt
ENTRYPOINT ["sh", "-c", "/fnetd/build/fnetd -p $PORT_DEBUG -u pwn -lt 2 -lm 536870912 /home/pwn/debug/vuln & /fnetd/build/fnetd -p $PORT_RELEASE -u pwn -lt 2 -lm 536870912 /home/pwn/release/vuln"]