writeup/Bandit

Bandit Level 0 -> Level 5

tnvori 2025. 2. 5. 17:51

Level 0

그동안의 내용을 리마인드하기 위해 Bandit을 풀어보려고 한다.

 

https://overthewire.org/wargames/bandit/bandit0.html

 

OverTheWire: Level Goal

We're hackers, and we are good-looking. We are the 1%. <!-- Please read and accept the Rules! --> Level Goal 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.org, on port 222

overthewire.org

 

처음은 접속부터,,

명령어는 ssh [사용자 계정]@[대상 주소] -p [대상 포트]이다.

ssh bandit0@bandit.labs.overtherwire.org -p 2220

위와 같이 입력하고 패스워드 bandit0을 입력하여 접속.

 

 

 

Level 0 -> Level 1

https://overthewire.org/wargames/bandit/bandit1.html

 

OverTheWire: Level Goal

We're hackers, and we are good-looking. We are the 1%. <!-- Please read and accept the Rules! --> Level Goal The password for the next level is stored in a file called readme located in the home directory. Use this password to log into bandit1 using SSH. W

overthewire.org

home 디렉토리에서 패스워드가 적혀있는 readme 파일을 읽는 문제.

 

pwd와 ls로 현재 위치와 해당 위치의 파일을 확인하고,

 

cat으로 파일을 실행하여 패스워드를 획득한다.

 

 

Level 1 -> Level 2

https://overthewire.org/wargames/bandit/bandit2.html

 

OverTheWire: Level Goal

We're hackers, and we are good-looking. We are the 1%. <!-- Please read and accept the Rules! --> Level Goal The password for the next level is stored in a file called - located in the home directory Commands you may need to solve this level ls , cd , cat

overthewire.org

패스워드가 -라는 파일명에 저장되어 있다고 한다.

 

파일명에 특수문자가 있는 파일을 어떻게 실행할지 묻는 문제이다.

특수문자 앞에 이스케이프 문자(\)를 붙이면 됐던 거 같은데

일단 다른 방법도 있다.

.과 /로 경로를 지정해서 현재 디렉토리의 파일에 접근하면 된다.

성공.

 

rm으로는 되는데 cat으로는 -에 접근이 안 된다.

 

확인을 위해 몇 개 만들어봤다.

 

의도대로 되는 모습

- 뒤에 옵션을 입력받을 때의 설계에서 명령어마다 차이가 있는 듯.

 

 

Level 2 -> Level 3

https://overthewire.org/wargames/bandit/bandit3.html

 

OverTheWire: Level Goal

We're hackers, and we are good-looking. We are the 1%. <!-- Please read and accept the Rules! --> Level Goal The password for the next level is stored in a file called spaces in this filename located in the home directory Commands you may need to solve thi

overthewire.org

이번엔 파일명에 공백이 존재한다.

 

방금 시도했던 이스케이프 문자를 사용해도 되고, 상대경로로 접근해도 알아서 처리해준다.

 

 

Level 3 -> Level 4

https://overthewire.org/wargames/bandit/bandit4.html

 

OverTheWire: Level Goal

We're hackers, and we are good-looking. We are the 1%. <!-- Please read and accept the Rules! --> Level Goal The password for the next level is stored in a hidden file in the inhere directory. Commands you may need to solve this level ls , cd , cat , file

overthewire.org

inhere 디렉토리의 숨겨진 파일을 실행해야 한다.

 

ls의 -a는 숨김 파일을 포함한 목록을 출력하는데, 이번 문제에서는 이것을 사용하면 해결된다.

 

 

 

https://overthewire.org/wargames/bandit/bandit5.html

 

OverTheWire: Level Goal

We're hackers, and we are good-looking. We are the 1%. <!-- Please read and accept the Rules! --> Level Goal The password for the next level is stored in the only human-readable file in the inhere directory. Tip: if your terminal is messed up, try the “r

overthewire.org

inhere에서 human-readable 파일을 찾는 문제이다.

file 명령어를 통해 대상 파일이 어떤 파일인지 확인할 수 있다. 이때 텍스트라면 human-readable이다.

 

 

이렇게 현재 디렉토리의 모든 파일을 한 번에 확인할 수도 있다.

'writeup > Bandit' 카테고리의 다른 글

Bandit Level 17 -> Level 19  (0) 2025.03.04
Bandit Level 14 -> Level 17  (0) 2025.02.27
Bandit Level 12 -> Level 14  (0) 2025.02.25
Bandit Level 9 -> Level 12  (0) 2025.02.11
Bandit Level 5 -> Level 8  (0) 2025.02.09