first commit
This commit is contained in:
commit
fe8f638952
27
Dockerfile
Normal file
27
Dockerfile
Normal file
@ -0,0 +1,27 @@
|
||||
FROM debian:bookworm
|
||||
|
||||
COPY _files /tmp/
|
||||
|
||||
RUN mv /tmp/flag.sh /flag.sh \
|
||||
&& mv /tmp/sources.list /etc/apt/sources.list \
|
||||
&& mv /tmp/edi* /usr/local \
|
||||
&& apt-get update \
|
||||
&& apt-get --no-install-recommends -y install \
|
||||
wget apt-utils sudo ca-certificates \
|
||||
vim openssh-server file \
|
||||
&& mv /tmp/docker-entrypoint /usr/local/bin/ \
|
||||
&& chmod +x /usr/local/bin/* \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /tmp/* /var/tmp/*
|
||||
|
||||
RUN useradd -p '$y$j9T$uCHtN.yDpIqN.PioeaThD.$Cc/8vnnZj.IuNP0aJhtwRMkaAYnBojjLDFBRhz6PIQ8' ctf \
|
||||
&& chsh -s /bin/bash ctf \
|
||||
&& mkdir /home/ctf \
|
||||
&& mv /usr/local/edi* /home/ctf \
|
||||
&& chmod 4755 /home/ctf/edit \
|
||||
&& chmod o+r /etc/sudoers /etc/apt/sources.list \
|
||||
&& chmod 744 /home/ctf/edit.c
|
||||
|
||||
EXPOSE 22
|
||||
|
||||
CMD ["/bin/sh", "-c", "/usr/local/bin/docker-entrypoint"]
|
10
_files/docker-entrypoint
Normal file
10
_files/docker-entrypoint
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ -f /flag.sh ]]; then
|
||||
source /flag.sh
|
||||
fi
|
||||
|
||||
mkdir /run/sshd
|
||||
/usr/sbin/sshd
|
||||
|
||||
tail -F /dev/null
|
BIN
_files/edit
Executable file
BIN
_files/edit
Executable file
Binary file not shown.
11
_files/edit.c
Normal file
11
_files/edit.c
Normal file
@ -0,0 +1,11 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
setuid( 0 );
|
||||
system( "vim /etc/apt/sources.list" );
|
||||
return 0;
|
||||
}
|
14
_files/flag.sh
Normal file
14
_files/flag.sh
Normal file
@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "$GZCTF_FLAG" > /flag
|
||||
chown root:root /flag
|
||||
chmod o-r /flag
|
||||
|
||||
unset GZCTF_FLAG
|
||||
|
||||
export GZCTF_FLAG="flag in /flag!"
|
||||
GZCTF_FLAG="flag in /flag!"
|
||||
export FLAG="flag in /flag!"
|
||||
echo $FLAG > /home/ctf/flag
|
||||
chown ctf:ctf /home/ctf/flag
|
||||
rm -rf /flag.sh
|
4
_files/sources.list
Normal file
4
_files/sources.list
Normal file
@ -0,0 +1,4 @@
|
||||
deb http://mirrors.bfsu.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
|
||||
deb http://mirrors.bfsu.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
|
||||
deb http://mirrors.bfsu.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
|
||||
deb http://mirrors.bfsu.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
|
BIN
_files/sudo_1.9.5p2-1_amd64.deb
Normal file
BIN
_files/sudo_1.9.5p2-1_amd64.deb
Normal file
Binary file not shown.
0
docker-compose.yaml
Normal file
0
docker-compose.yaml
Normal file
Loading…
x
Reference in New Issue
Block a user