본문 바로가기

Wargame/Krypton

[ Docker ] Krypton Wargame 만들기 - 0번 문제 ( 2 / 8 )

1. Krypton0 목표

Welcome to Krypton! The first level is easy. 
The following string encodes the password using Base64:
S1JZUFRPTklTR1JFQVQ=

Use this password to log in to krypton.labs.overthewire.org with 
username krypton1 using SSH on port 2231.
You can find the files for other levels in /krypton/

 

2. Krypton0 구현

# 비밀번호 root 입력 접속
ssh -oStrictHostKeyChecking=no root@localhost -p 2231

useradd krypton1

echo -e "KRYPTONISGREAT\nKRYPTONISGREAT" | passwd krypton1

chown root:root /home/krypton1

chown -R root:root /home/krypton1/.[!.]*

chmod 755 /home/krypton1

echo 'KRYPTONISGREAT' > /etc/krypton_pass/krypton1

chown krypton1:krypton1 /etc/krypton_pass/krypton1

chmod 400 /etc/krypton_pass/krypton1

 

3. Krypton0 문제풀의

# base64 디코딩을 통하여 비밀번호 확인
# 윈도우에서는 echo S1JZUFRPTklTR1JFQVQ= | certutil -decode -f stdin stdout
# 비밀번호 : KRYPTONISGREAT
# KRYPTONISGREAT
echo S1JZUFRPTklTR1JFQVQ= | base64 --decode | xxd | awk '{print $NF}' 1>&1

# 비밀번호 : KRYPTONISGREAT
ssh krypton1@localhost -p 2231

# 비밀번호 확인
cat /etc/krypton_pass/krypton1