보안/Bandit 워게임

OverTheWire - Bandit : Level 3 → Level 4

Security Engineer 2023. 3. 28. 21:00

OverTheWire - Bandit

강의목차: Level 3 → Level 4(cat과 숨김파일)

 

Bandit 웹페이지

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

 

 

 

1. Bandit Level 3 → 4

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 , du , find

 

다음 레벨의 패스워드는 inhere 디렉터리의 숨김파일에 저장되어 있다.

 

$ ssh -p 2220 bandit3@bandit.labs.overthewire.org

level 3 패스워드: aBZ0W5EmUfAf7kHTQeOwd8bauFJ2lAiG

 

$ ls

$ file ./inhere ( inhere 의 파일 형태 확인 )

ls 해서 봤더니 파란색으로 inhere 가 되어있다.

inhere 는 디렉터리라는 것을 확인 할 수 있다.

 

$ ls -al

-a 옵션을 붙이면 숨김 파일도 출력한다.
-l 옵션을 붙이면 소유자, 파일 크기 등 자세한 정보도 같이 출력한다.
-al 옵션을 붙이면 숨김 파일을 포함하여 자세한 정보를 출력한다.
제일 앞에 d가 있는 것은 디렉터리(폴더), -가 있는 것은 파일이다.

 

숨김파일은 . (마침표) 로 시작하며, 일반적인 파일 리스팅 명령으로는 확인할 수 없다.

 

$ cd inhere ( inhere 디렉터리로 위치 이동 )
$ ls -al ( 숨김파일도 출력 )
$ cat .hidden ( 숨김파일인 .hidden 파일 출력 )

$ cat ./.hidden ( 현재 위치에서 숨김파일인 .hidden 파일 출력 )

다음 레벨 패스워드: 2EW7BBsr6aMMoJ2HjW067dm8EgX26xNe

 

 

$ cat *

$ cat ./*

당연히 cat * ( 모든 파일 출력 )은 안된다 → 숨김파일이므로

 

$ cd ~ ( 이전 디렉터리로 이동 )
$ cd .. ( 이전 디렉터리로 이동 )
$ pwd ( 현재 디렉터리 위치 확인 )

$ exit ( ssh 접속 상태에서 홈으로 나가기 )

 

 

 

Level 4 에 로그인 시도

 

ssh -p 2220 bandit4@bandit.labs.overthewire.org

Level 4 패스워드: 2EW7BBsr6aMMoJ2HjW067dm8EgX26xNe

 

$ whoami

$ id

입력하여 현재 로그인한 계정 확인

 

 

 

 


취미로 해킹1 강의 : https://www.inflearn.com/course/linux-3