cscg24-flipnote

CSCG 2024 Challenge 'FlipNote'
git clone https://git.sinitax.com/sinitax/cscg24-flipnote
Log | Files | Refs | sfeed.txt

Dockerfile (2489B)


      1FROM ubuntu:jammy-20240227@sha256:77906da86b60585ce12215807090eb327e7386c8fafb5402369e421f44eff17e as builder
      2
      3ADD --chmod=0755 --checksum=sha256:4c97fd03a3b181996b1473f3a99b69a1efc6ecaf2b4ede061b6bd60a96b9325a \
      4    https://raw.githubusercontent.com/reproducible-containers/repro-sources-list.sh/v0.1.0/repro-sources-list.sh \
      5    /usr/local/bin/repro-sources-list.sh
      6
      7RUN \
      8    --mount=type=cache,target=/var/cache/apt,sharing=locked \
      9    --mount=type=cache,target=/var/lib/apt,sharing=locked \
     10    /usr/local/bin/repro-sources-list.sh && \
     11    apt-get update && apt-get install -y \
     12    musl-dev \
     13    musl-tools \
     14    make \
     15    xz-utils \
     16    gcc
     17
     18WORKDIR /work
     19
     20ADD --chmod=0666 --checksum=sha256:4300f2fbc3996bc389d3c03a74662bfff3106ac1930942c5bd27580c7ba5053d \
     21    https://yx7.cc/code/ynetd/ynetd-0.1.2.tar.xz \
     22    /work/ynetd-0.1.2.tar.xz
     23
     24RUN tar -xJf ynetd-0.1.2.tar.xz && cd ynetd-0.1.2 && CC="musl-gcc" CFLAGS="-static" make
     25
     26COPY vuln.c .
     27RUN gcc -g -pie -fcf-protection -frandom-seed=0 -fno-plt -fstack-protector-all -fstack-clash-protection -O3 -g -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -Wall -Wextra vuln.c -o vuln
     28
     29RUN echo "7cdf302e663641c132daaae59f82ceaebd8780f37eccc7844e17ddea3c82b664  /work/vuln" | sha256sum --check
     30
     31FROM ubuntu:jammy-20240227@sha256:77906da86b60585ce12215807090eb327e7386c8fafb5402369e421f44eff17e
     32
     33COPY --from=builder /work/ynetd-0.1.2/ynetd /ynetd
     34COPY --from=builder /work/vuln /vuln
     35
     36ADD --chmod=0755 --checksum=sha256:4c97fd03a3b181996b1473f3a99b69a1efc6ecaf2b4ede061b6bd60a96b9325a \
     37    https://raw.githubusercontent.com/reproducible-containers/repro-sources-list.sh/v0.1.0/repro-sources-list.sh \
     38    /usr/local/bin/repro-sources-list.sh
     39
     40RUN \
     41    --mount=type=cache,target=/var/cache/apt,sharing=locked \
     42    --mount=type=cache,target=/var/lib/apt,sharing=locked \
     43    /usr/local/bin/repro-sources-list.sh && \
     44    apt-get update && \
     45    apt-get install -y dropbear rsync openssh-client gdbserver && \
     46    rm /var/cache/ldconfig/aux-cache /var/log/apt/term.log /var/log/apt/history.log /var/log/dpkg.log /var/log/alternatives.log && \
     47    rm -rf /etc/dropbear/dropbear_*_host_key
     48
     49COPY --chmod=600 --chown=root:root dropbear_ecdsa_host_key dropbear_ed25519_host_key dropbear_rsa_host_key /etc/dropbear/
     50
     51RUN chown root /vuln && chmod 4555 /vuln
     52COPY ./flag /flag
     53RUN chmod 600 /flag
     54RUN useradd -d /home/ctf/ -m -s /bin/bash ctf && passwd -d ctf
     55RUN passwd -d root
     56
     57WORKDIR /home/ctf
     58
     59CMD ["dropbear", "-FBREkp", "1024"]