Last active
April 13, 2021 21:24
-
-
Save one2blame/665a62709f1ad6b5f775b456b71f49bc to your computer and use it in GitHub Desktop.
Dockerfile with LD_PRELOAD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:18.04 | |
RUN DEBIAN_FRONTEND=noninteractive apt-get update -y && apt-get install -y \ | |
socat \ | |
&& rm -rf /var/lib/apt/lists/* | |
RUN useradd -m my-challenge | |
WORKDIR /home/my-challenge | |
COPY my-challenge | |
COPY libc.so.6 . | |
COPY ld-2.27.so . | |
COPY flag . | |
RUN chown -R root:my-challenge /home/my-challenge && \ | |
chmod -R 750 /home/my-challenge && \ | |
chmod 740 /home/my-challenge/flag | |
EXPOSE 4444 | |
USER my-challenge | |
CMD while true; do \ | |
socat TCP-LISTEN:4444,reuseaddr,fork EXEC:"env LD_PRELOAD=./libc.so.6 ./ld-2.27.so ./my-challenge",stderr; \ | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment