2023.04.03 - [Bandit] - Bandit(0 ~ 7)
Bandit(0 ~ 7)
URL : https://overthewire.org/wargames/bandit/ SSH Port : 2220 OS : kali-linux-2022.1-installer-amd64.iso Bandit 0 -> 1 1. The goal of this level is for you to log into the game using SSH. The host to which you need to connect is bandit.labs.overthewire.or
jisu069.tistory.com
URL : https://overthewire.org/wargames/bandit/
SSH Port : 2220
OS : kali-linux-2022.1-installer-amd64.iso
Bandit7 -> 8
1. The password for the next level is stored in the file data.txt next to the word millionth
01. data.txt파일에 많은 내용이 있으므로 vi를 통해 data.txt에서 millionth을 확인
bandit7:~$ ls
data.txt
bandit7:~$ vi ./data.txt
/millionth
<다른방법!!>
bandit7:~$ cat data.txt | grep millionth
bandit7:~$ grep millionth ./data.txt
![]() |
![]() |
bandit8의 PW : TESKZC0XvTetK0S9xNwm25STk5iWrBvP
ssh bandit8@bandit.labs.overthewire.org -p 2220
PW: TESKZC0XvTetK0S9xNwm25STk5iWrBvP
Bandit8 -> 9
1. The password for the next level is stored in the file data.txt and is the only line of text that occurs only once
01. data.txt에서 중복되지 않는 암호문을 찾는다
badnit8:~$ sort data.txt | uniq -u
EN632PlfYiZbn3PhVK3XOGSlNInNE00t
※ sort로 data.txt를 정렬한다음 uniq 명령어로 중복되지 않는 문자열을 찾는다. (-u옵션은 중복되지 않는 라인만 표시한다)
![]() |
![]() |
bandit9의 PW : EN632PlfYiZbn3PhVK3XOGSlNInNE00t
ssh bandit9@bandit.labs.overthewire.org -p 2220
PW : EN632PlfYiZbn3PhVK3XOGSlNInNE00t
Bandit9 -> 10
1.The password for the next level is stored in the file data.txt in one of the few human-readable strings, preceded by several ‘=’ characters.
01. data.txt의 파일을 읽었을 때 깨지는 것을 확인
file 명령어를 통해 확인 했을 때 data.txt는 data 형식인것을 확인
02. 사람이 읽을 수 있는 형태로 확인하기
bandit9@bandit:~$ strings data.txt
※ strings는 사람이 읽을 수 있는 형태로 파일을 추출해서 보여준다
03. = 로 시작하는 것으로 PW 찾기
bandit9@bandit:~$ strings data.txt | grep =
========== the Z
=7'l/BW
~ 5=
@d========== password
========== is
IcaC=m
{>)=$,
^= j{
y)=E
========== G7w8LIi6J3kTb8A7j9LgrywtEUlyyp6s
5?=k
=Vr%
\> =
g=>M
![]() |
![]() |
![]() |
![]() |
bandit10의 PW :G7w8LIi6J3kTb8A7j9LgrywtEUlyyp6s
ssh bandit10@bandit.labs.overthewire.org -p 2220
PW: G7w8LIi6J3kTb8A7j9LgrywtEUlyyp6s
Bandit10 -> 11
1.The password for the next level is stored in the file data.txt, which contains base64 encoded data
★BASE64 Encoding
- Encoding : Key가 필요 없이 파일을 변화시킨다
- Encryption : Key가 필요하고 Key로 파일을 암호화시킨다
01. data.txt를 cat으로 확인하면 == 형태를 확인할 수 있는데 '='이 마지막에 한개 이상있을 경우 base64 인코딩된것을 의심
bandit10@bandit:~$ cat data.txt
VGhlIHBhc3N3b3JkIGlzIDZ6UGV6aUxkUjJSS05kTllGTmI2blZDS3pwaGxYSEJNCg==
02. Base 64를 Decoding 하여 확인하기
bandit10@bandit:~$ base64 --decode data.txt
The password is 6zPeziLdR2RKNdNYFNb6nVCKzphlXHBM
![]() |
![]() |
bandit11의 PW :6zPeziLdR2RKNdNYFNb6nVCKzphlXHBM
ssh bandit11@bandit.labs.overthewire.org -p 2220
PW: 6zPeziLdR2RKNdNYFNb6nVCKzphlXHBM
Bandit11->12
1. The password for the next level is stored in the file **data.txt**, where all lowercase (a-z) and uppercase (A-Z) letters have been rotated by 13 positions
* * *
★ ROT13 Encryption : 평문을 13을 미뤄서 암호화 시킨것
01. ROT13으로 암호화된 파일을 확인
bandit11@bandit:~$ cat data.txt
Gur cnffjbeq vf WIAOOSFzMjXXBC0KoSKBbJ8puQm5lIEi
02-1. 리눅스에서 복호화 하는 방법(tr 명령어 이용)
bandit11@bandit:~$ cat data.txt | tr '[A-Za-z]' '[N-ZA-Mn-za-m]'
The password is JVNBBFSmZwKKOP0XbFXOoW8chDz5yVRv
☆ tr 명령어는 문자열을 치환하는 명령어인데
[A-Za-z]까지를 13까지 미룬 [N-ZA-Mn-za-m]으로 치환시켜 복호화시켰다
<다른 방법!!>
02-2. rot13 사이트를 이용하여 복호화
https://rot13.com/
![]() |
![]() |
![]() |
![]() |
bandit12의 PW :G7w8LIi6J3kTb8A7j9LgrywtEUlyyp6s
ssh bandit12@bandit.labs.overthewire.org -p 2220
PW: JVNBBFSmZwKKOP0XbFXOoW8chDz5yVRv
Bandit12->13
1.The password for the next level is stored in the file **data.txt**, which is a hexdump of a file that has been repeatedly compressed. For this level it may be useful to create a directory under /tmp in which you can work using mkdir. For example: mkdir /tmp/myname123. Then copy the datafile using cp, and rename it using mv (read the manpages!)
★ hexdump : 파일의 내용을 16진수화 시킨것
★ xxd : hexdump로 만들거나 역으로 푸는 명령어
01. hexdump를 binaryfile로
bandit12@bandit:/tmp/jjs$ xxd -r data.txt > reverse_data.txt
02. 파일 형태 확인하기
bandit12@bandit:/tmp/jjs$ file reverse_data.txt
reverse_data.txt: gzip compressed data, was "data2.bin", last modified: Sun Jan 8 17:07:50 2023, max compression, from Unix,
original size modulo 2^32 574
03. 압축해제하기
gzip -> 확장자 : .gz, 압축 해제 : gunzip [파일명]
bzip -> 확장자 : .bz2, 압축 해제 : bzip2 -d [파일명]
tar -> 확장자 : .tar, 압축 해제 : tar -xf [파일명]
계속 해서 파일의 형태를 확인하고 압축되어 있을 경우 풀어준다
bandit12@bandit:/tmp/jjs$ file data8
data8: ASCII text
bandit12@bandit:/tmp/jjs$ cat data8
The password is wbWdlBxEir4CaE8LaPhauuOo6pwRmrDw
![]() |
![]() |
![]() |
![]() |
bandit13의 PW :wbWdlBxEir4CaE8LaPhauuOo6pwRmrDw
ssh bandit13@bandit.labs.overthewire.org -p 2220
PW: wbWdlBxEir4CaE8LaPhauuOo6pwRmrDw
'개인 공부 > Bandit' 카테고리의 다른 글
Bandit 24 ~ 26 (0) | 2023.04.09 |
---|---|
Bandit 21 ~ 23 (0) | 2023.04.08 |
Bandit 17 ~ 20 (0) | 2023.04.07 |
Bandit 13 ~ 16 (0) | 2023.04.06 |
Bandit(0 ~ 6) (0) | 2023.04.03 |