diff --git a/ansible/roles/deploy_tasks/tasks/main.yaml b/ansible/roles/deploy_tasks/tasks/main.yaml index baae1fe..be01ebd 100644 --- a/ansible/roles/deploy_tasks/tasks/main.yaml +++ b/ansible/roles/deploy_tasks/tasks/main.yaml @@ -69,6 +69,7 @@ - 24 - 27 - 28 + - 2502 - name: upload cleanup docker script copy: diff --git a/ansible/roles/deploy_tasks/templates/suzen2502.j2 b/ansible/roles/deploy_tasks/templates/suzen2502.j2 new file mode 100644 index 0000000..6ca3052 --- /dev/null +++ b/ansible/roles/deploy_tasks/templates/suzen2502.j2 @@ -0,0 +1,18 @@ +#!/bin/bash + +ID="$1" +TAG="$2" +if [ "$TAG" == "latest" ]; then + TAG="latest:1234567890" +fi + +dockerstdout=$(docker exec ${ID} md5sum /home/suzen/diary.txt) +echo $dockerstdout +dockerstdout=$(tr -dc '[[:print:]]' <<< "$dockerstdout") +md5=$(echo ${dockerstdout} | awk '{print $1}') +echo $md5 + +if [[ "$md5"="c00f9a27ecb962c76600167ebc3e2dc7" && 'stat -c %A /home/suzen/diary.txt'="--w-r--rw-" ]]; then + FLAG="{{ levels | selectattr('name', 'equalto', 'suzen2502') | map(attribute='flag') | join(',') }}" + docker exec ${ID} mkdir "/home/suzen/${FLAG}" +fi diff --git a/ansible/vars.yaml b/ansible/vars.yaml index b79ef14..f811963 100644 --- a/ansible/vars.yaml +++ b/ansible/vars.yaml @@ -374,6 +374,29 @@ levels : flag : "V2kwTGFlN0FwaGllTmd1OWVlc2gK" chain : 19 + #Chain25 + #chmod W + - name : suzen2501 + password: "suzen2501" + sault : "vsiuyTqw" + flag : "Gj5DjtFMvw59AlcmwTh6Hd6bAyhR" + chain : 25 + + # chmod R + - name : suzen2502 + password: "Gj5DjtFMvw59AlcmwTh6Hd6bAyhR" + sault : "vsiuyTqw" + flag : "V2kwTGFlN0FwaGllTmd1OWVlc2gK" + chain : 25 + + #chmod X, R + find + - name : suzen2503 + password: "V2kwTGFlN0FwaGllTmd1OWVlc2gK" + sault : "vsiuyTqw" + flag : "YWVnaGdTanVvejd2b5760HNvaEwK" + chain : 25 + + ## EXAMPLE TEMPLATE # - name : suzen # password: "" diff --git a/chains/chain25/level2501/Dockerfile b/chains/chain25/level2501/Dockerfile new file mode 100644 index 0000000..0953a84 --- /dev/null +++ b/chains/chain25/level2501/Dockerfile @@ -0,0 +1,12 @@ +FROM debian:buster + +ADD hello /bin +RUN useradd -m suzen + +ADD flag /home/suzen + +RUN chmod 000 /home/suzen/flag && chown suzen /home/suzen/flag + +ENTRYPOINT ["/bin/hello"] +WORKDIR /home/suzen +USER suzen diff --git a/chains/chain25/level2501/flag b/chains/chain25/level2501/flag new file mode 100644 index 0000000..7600a64 --- /dev/null +++ b/chains/chain25/level2501/flag @@ -0,0 +1 @@ +Gj5DjtFMvw59AlcmwTh6Hd6bAyhR diff --git a/chains/chain25/level2501/hello b/chains/chain25/level2501/hello new file mode 100755 index 0000000..1d29a70 --- /dev/null +++ b/chains/chain25/level2501/hello @@ -0,0 +1,9 @@ +#!/bin/bash +echo -e "\n#############################################" +echo -e "# #" +echo -e "# Hello! It's level 2501 #" +echo -e "# #" +echo -e "# Read file with the FLAG #" +echo -e "# #" +echo -e "#############################################" +bash \ No newline at end of file diff --git a/chains/chain25/level2502/Dockerfile b/chains/chain25/level2502/Dockerfile new file mode 100644 index 0000000..84b968a --- /dev/null +++ b/chains/chain25/level2502/Dockerfile @@ -0,0 +1,12 @@ +FROM debian:buster + +ADD hello /bin +RUN useradd -m suzen + +ADD diary.txt /home/suzen + +RUN chmod 000 /home/suzen/diary.txt && chown suzen /home/suzen/diary.txt + +ENTRYPOINT ["/bin/hello"] +WORKDIR /home/suzen +USER suzen diff --git a/chains/chain25/level2502/diary.txt b/chains/chain25/level2502/diary.txt new file mode 100644 index 0000000..e69de29 diff --git a/chains/chain25/level2502/hello b/chains/chain25/level2502/hello new file mode 100755 index 0000000..24c6469 --- /dev/null +++ b/chains/chain25/level2502/hello @@ -0,0 +1,14 @@ +#!/bin/bash +echo -e "\n#############################################" +echo -e "# #" +echo -e "# Hello! It's level 2502 #" +echo -e "# #" +echo -e "# Give such rights to diary.txt : #" +echo -e "# -Owner only to Write, #" +echo -e "# -Group only to Read #" +echo -e "# -Others to Read and Write #" +echo -e "# And write "SuzenEscape" to diary.txt #" +echo -e "# Wait for 1 minute and the flag will appear#" +echo -e "# #" +echo -e "#############################################" +bash diff --git a/chains/chain25/level2503/Dockerfile b/chains/chain25/level2503/Dockerfile new file mode 100644 index 0000000..ea86033 --- /dev/null +++ b/chains/chain25/level2503/Dockerfile @@ -0,0 +1,14 @@ +FROM debian:buster + +ADD hello /bin +RUN useradd -m suzen + +ADD Help /home/suzen +ADD fLaG /run/lock +RUN chmod -R -x /run/lock && chown suzen /run/lock + +RUN chmod -r /home/suzen/Help && chown suzen /home/suzen/Help && chmod -R -x /home/suzen + +ENTRYPOINT ["/bin/hello"] +WORKDIR /home +USER suzen diff --git a/chains/chain25/level2503/Help b/chains/chain25/level2503/Help new file mode 100644 index 0000000..2ebdcfd --- /dev/null +++ b/chains/chain25/level2503/Help @@ -0,0 +1 @@ +You will find the flag in file "fLaG", but I don't know where it is. Saaaaave me, help me to escape \ No newline at end of file diff --git a/chains/chain25/level2503/fLaG b/chains/chain25/level2503/fLaG new file mode 100644 index 0000000..0597836 --- /dev/null +++ b/chains/chain25/level2503/fLaG @@ -0,0 +1,7 @@ +Congratulations, now you know something about chmod and find. +Your knowledge helped me to escape. Thank you. +Here is your flag. + +YWVnaGdTanVvejd2b5760HNvaEwK + +Have a good day or night :) \ No newline at end of file diff --git a/chains/chain25/level2503/hello b/chains/chain25/level2503/hello new file mode 100755 index 0000000..d265765 --- /dev/null +++ b/chains/chain25/level2503/hello @@ -0,0 +1,9 @@ +#!/bin/bash +echo -e "\n#############################################" +echo -e "# #" +echo -e "# Hello! It's level 2503 #" +echo -e "# #" +echo -e "# I won't help you. You can do it. #" +echo -e "# #" +echo -e "#############################################" +bash \ No newline at end of file